How to select executor for each job or stage?
My idea: I want to run the testing on the docker and after that it will be automatic start the docker container. I created two executor for my project.
[[runners]]
name = "docker_test"
url = "http://xxx.xxx.xxx.xxx/ci"
token = "55eeeb9bbc845fdb74c39e28a3545a"
executor = "docker"
[runners.docker]
tls_verify = false
image = "piuma/centos7-apache-php"
privileged = false
disable_cache = false
volumes = ["/cache"]
[runners.cache]
Insecure = false
[[runners]]
name = "shell_running"
url = "http://xxx.xxx.xxx.xxx/ci"
token = "6d6e8ee0e99d65f71455afae24285d"
executor = "shell"
[runners.ssh]
[runners.docker]
tls_verify = false
image = ""
privileged = false
disable_cache = false
[runners.parallels]
base_name = ""
disable_snapshots = false
[runners.virtualbox]
base_name = ""
disable_snapshots = false
[runners.cache]
Insecure = false
And .gitlab-ci.yml and create a docker-compose.yml for deploying to devops server:
variables:
DOCKER_HOST: "tcp://0.0.0.0:4243"
makeatest:
stage: test
image: eboraas/laravel
script: |
chmod +x test-script.sh
./test-script.sh
makeadeploy:
stage: deploy
dependencies:
- makeatest
script: |
docker-compose stop
docker-compose up -d
But when the jobs is running it is selected random between shell & docker executor. The problem is makeatest only work correctly if it is running with docker executor and makeadeploy only work correctly if it is running with shell executor. I tried to find the solution without successfully. How can I select the executor for each jobs without using tags? Thanks.