Hello,
I am trying to add CI in my GitLab repository that houses a node.js server and mocha tests (found in a file named test.bash).
The server itself builds a local database to execute the tests.
I have installed all the necessary components manually such as redis and mongodb.
Until now, I successfully started the redis-server (using the service redis-server start command)
but I am failing to do the same for mongodb, I get the message that this service is not defined.
Although the mongodb is installed (version 4.0.5) and I can see its binaries, I cannot find it in the /etc/init.d/
directory.
Did anybody face this issue?
Here is my .gitlab-ci.yml file:
cache:
paths:
- node_modules/
stages:
- build
- test
build:
stage: build
image: node:latest
before_script:
- apt-get update
script:
- npm i
test:
stage: test
image: node:latest
before_script:
- apt-get update
- curl https://www.mongodb.org/static/pgp/server-4.0.asc | apt-key add -
- echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list
- apt-get -y install apt-transport-https
- apt-get -y install autoconf build-essential
- apt-get -y install redis-server
- apt-get install -y mongodb-org=4.0.5 mongodb-org-server=4.0.5 mongodb-org-shell=4.0.5 mongodb-org-mongos=4.0.5 mongodb-org-tools=4.0.5
script:
- service redis-server status || service redis-server start
- service mongod status || service mongod start
- bash test.sh