image: registry.gitlab.com/openstapps/projectmanagement/node stages: - build - test - audit - publish before_script: - npm ci build: stage: build script: - npm run build artifacts: paths: - lib unit: stage: test script: - npm test coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/' artifacts: reports: coverage_report: coverage_format: cobertura path: coverage/cobertura-coverage.xml audit: allow_failure: true except: - schedules script: - npm audit stage: audit scheduled-audit: only: - schedules script: - npm audit --audit-level=high stage: audit docker image build: image: registry.gitlab.com/openstapps/projectmanagement/builder stage: test dependencies: - build variables: DOCKER_DRIVER: overlay2 services: - docker:dind script: - docker build -t $CI_REGISTRY_IMAGE/$REGISTRY_BRANCH$CI_COMMIT_REF_NAME:latest . tags: - docker docker image: image: registry.gitlab.com/openstapps/projectmanagement/builder stage: publish dependencies: - build variables: DOCKER_DRIVER: overlay2 services: - docker:dind script: - export VERSION=$(echo -n "$CI_BUILD_REF_NAME" | cut -c 2-) - export IMAGETAG_BASE=$CI_REGISTRY_IMAGE - export IMAGETAG_VERSION=$IMAGETAG_BASE:$VERSION - export IMAGETAG_LATEST=$IMAGETAG_BASE:latest - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - docker build -t $IMAGETAG_VERSION -t $IMAGETAG_LATEST . - docker push $IMAGETAG_BASE only: - /^v[0-9]+\.[0-9]+\.[0-9]+$/ tags: - docker pages: artifacts: paths: - public only: - /^v[0-9]+\.[0-9]+\.[0-9]+$/ script: - npm run documentation - mv docs public stage: publish