# to reduce duplication, try to use the includes from the gitlab_shared_ci project include: - project: infrastructure/gitlab_shared_ci file: nodejs_pipeline.yml stages: - setup - test - package - publish services: - name: docker.io/bitnami/mariadb:10.3@sha256:5cd67ca0f6161cb17bbc646c7740029547d21452cbce372d53bcaa640ccb58f3 alias: mariadb variables: MARIADB_ROOT_PASSWORD: password MARIADB_DATABASE: corellium-coordinator test: stage: test script: # If you want to test if the mariadb service is connectable, uncomment these: # - apt-get update && apt-get install mariadb-client -y # - mysqladmin -u root -ppassword -P 3306 -h mariadb status - npm ci - npm run test:ci artifacts: paths: - coverage/ reports: coverage_report: coverage_format: cobertura path: coverage/cobertura-coverage.xml package: image: name: ${CI_REGISTRY}/corellium/ci/docker/nodejs:16 pull_policy: [always, if-not-present] stage: package needs: - job: test artifacts: false script: - npm config set fund false - npm config set audit false - ./ci/gitlab-build.sh --cicd || exit $? artifacts: paths: - output/ allow_failure: exit_codes: - 200 release-publish: image: name: git.corellium.co:5050/corellium/ci/docker/nodejs:16 pull_policy: [always, if-not-present] stage: publish before_script: # add keys to enable git submodule checkout (this should be unnecessary if using relative urls) - eval $(ssh-agent -s) - mkdir -p ~/.ssh - echo "$GITOLITE_SSH_PRIV_KEY" | ssh-add - - echo "$GITLAB_CI_DEPLOY_KEY" | tr -d '\r' | ssh-add - - ssh-keyscan gitlab01.corellium.co >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts # set internal npm cache - npm set registry http://10.10.0.160:4873 # set gitlab @corellium npm registry - npm set -- //git.corellium.co/api/v4/packages/npm/:_authToken=${CI_JOB_TOKEN} - npm set -- //git.corellium.co/api/v4/projects/354/packages/npm/:_authToken=${CI_JOB_TOKEN} - npm set @corellium:registry https://git.corellium.co/api/v4/packages/npm/ script: # Attempt to parse commit tag of format vX.X.X - RELEASE_VERSION=${CI_COMMIT_TAG#v} - | if [[ -z "$RELEASE_VERSION" ]]; then echo "Error: Failed to parse release version from tag ${CI_COMMIT_TAG}" exit 1 fi # Configure npmrc to publish to npm registry - echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc - npm ci --unsafe-perm --ignore-scripts - jq ".version = \"${RELEASE_VERSION}\"" package.json > temp.json - mv temp.json package.json # - git checkout -b version-bump # - git commit -m "Update package.json version to ${RELEASE_VERSION}" # - git push HEAD:master - jq . package.json - npm publish --@corellium:registry=https://registry.npmjs.org/ rules: - if: '$CI_COMMIT_TAG =~ /^v/'