I am getting this error when trying to use a gitlabs ci/cd variable inside the .gitlab-ci.yml file.
workflow:
name: Solar System NodeJS Pipeline
rules:
- if: $CI_COMMIT_BRANCH == ‘main’ || $CI_COMMIT_BRANCH =~ /^feature/
when: always
- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/ && $CI_PIPELINE_SOURCE == ‘merge_request_event’
when: always
stages: # List of stages for jobs, and their order of execution
- test
variables:
MONGO_URI: ‘mongodb+srv://supercluster.d83jj.mongodb.net/superData’
MONGO_USERNAME: superuser
MONGO_PASSWORD: ‘$M_DB_PASSWORD’
unit-testing: # This job runs in the test stage.
stage: test
image: node:17-alpine3.14
before_script:
- npm install
script:
- npm test
Error:
$ npm test27> Solar [email protected] test28> mocha app-test.js --timeout 10000 --reporter mocha-junit-reporter --exit29Server successfully running on port - 300030error!! MongoError: password must be a string31Cleaning up project directory and file based variables00:0032ERROR: Job failed: exit code 8