I'm trying to have 2 types of tests run depending on why the pipeline is being run. On commits I'd like to run my build stage, and on merge requests I'd like to run my build and test stages. When I do a commit it runs only build but it also only runs build on Merge Requests.
I've tried specifying only:merge_requests in my .gitlab-ci.yml but it still won't register the stage.
stages:
- build
- deploy
- test
- deploy_prod
build:
image: "python:3.6.1"
stage: build
variables:
GIT_SUBMODULE_STRATEGY: 'recursive'
script:
- pip install --upgrade pip
- pip install -r lender_v2/requirements.txt
- pip install -r lender_v2/reggora_models/requirements.txt
- export FLASK_CONFIG=localhost
- cd lender_v2/smoke_tests && python3 -m unittest discover -p "smoke_*.py" -q --failfast
test:
image: "python:3.6.1"
stage: test
variables:
GIT_SUBMODULE_STRATEGY: 'recursive'
script:
- pip install --upgrade pip
- pip install -r lender_v2/requirements.txt
- pip install -r lender_v2/reggora_models/requirements.txt
- export FLASK_CONFIG=localhost
- cd lender_v2/test_project && python3 -m unittest discover ../test_project -p "test_*.py" -q --failfast
only:
- merge_requests
I thought this should run the test stage on merge_requests but it won't run at any time.