Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.91 KiB
Newer Older
N5608's avatar
N5608 committed
#This declares the pipeline stages  
image: node:13.1

N5608's avatar
N5608 committed
stages:
  - build
  - test
N5608's avatar
N5608 committed
  - deploy
N5608's avatar
N5608 committed
  
N5608's avatar
N5608 committed
cache:
  paths:
  - node_modules/
N5608's avatar
N5608 committed
  
build:
  stage: build
  script:
N5608's avatar
N5608 committed
    - npm install
    - npm run-script build
  tags:
N5608's avatar
N5608 committed
    - docker
N5608's avatar
N5608 committed
    
test:
  stage: test
  script:
    - echo "Running react test suite......"
  tags:
N5608's avatar
N5608 committed
    - docker
N5608's avatar
N5608 committed

license_management:
  stage: test
  image:
N5608's avatar
N5608 committed
    name: "registry.gitlab.labranet.jamk.fi//gitlab-org/security-products/license-management:$CI_SERVER_VERSION_MAJOR-$CI_SERVER_VERSION_MINOR-stable"
N5608's avatar
N5608 committed
    entrypoint: [""]
  variables:
    SETUP_CMD: $LICENSE_MANAGEMENT_SETUP_CMD
  allow_failure: true
  script:
    - /run.sh analyze .
  artifacts:
    reports:
      license_management: $CI_PROJECT_DIR/gl-license-management-report.json
    expire_in: 1 week
  dependencies: []
  only:
    refs:
      - branches
    variables:
      - $GITLAB_FEATURES =~ /\blicense_management\b/
  except:
    variables:
      - $LICENSE_MANAGEMENT_DISABLED

  tags:
N5608's avatar
N5608 committed
    - docker
N5608's avatar
N5608 committed


code_quality:
  stage: test
  image: docker:stable
  allow_failure: true
  services:
    - docker:stable-dind
  variables:
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: ""
  script:
    - |
      if ! docker info &>/dev/null; then
        if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
N5608's avatar
N5608 committed
          export DOCKER_HOST='tcp://localhost:8080'
N5608's avatar
N5608 committed
        fi
      fi
    - docker run
        --env SOURCE_CODE="$PWD"
        --volume "$PWD":/code
        --volume /var/run/docker.sock:/var/run/docker.sock
N5608's avatar
N5608 committed
        "registry.gitlab.labranet.jamk.fi/gitlab-org/security-products/codequality:12-0-stable" /code
N5608's avatar
N5608 committed
  artifacts:
    reports:
      codequality: $CI_PROJECT_DIR/gl-code-quality-report.json
    expire_in: 1 week
    when: always
  dependencies: []
  only:
    refs:
      - branches
      - tags
  except:
    variables:
N5608's avatar
N5608 committed
      - $CODE_QUALITY_ENABLE
N5608's avatar
N5608 committed

  tags:
N5608's avatar
N5608 committed
    - docker
N5608's avatar
N5608 committed

N5608's avatar
N5608 committed
    
deploy:
  stage: deploy
  script:
N5608's avatar
N5608 committed
    - echo 'Deploy'
N5608's avatar
N5608 committed
  tags:
N5608's avatar
N5608 committed
    - docker
N5608's avatar
N5608 committed