Description
As I have found from this Stackoverflow question and Gitlab-CI official documentation, by using tags
keyword, different runners can be triggered for a single project. So I have registered different runners on my servers (one runner for each (staging and production) server) with dashboard_staging
and dashboard_production
tag names.
Everything works well and in order to start gitlab-runner properly, I have executed the following commands:
sudo gitlab-runner verify # Everything was ok
sudo gitlab-runner start # It was started successfully on both servers
Then I have committed the changes and push them on Gitlab and it was triggered successfully.
Problems
- I have executed the above commands, but one of the pipelines is still pending for a runner.
- Since
build
stage has not been done completely, it wouldn't progressed for the tag in which its job has been done.
Code
stages:
- test
- build
- deploy
cache:
untracked: true
key:
files:
- yarn.lock
paths:
- node_modules/
- .yarn
dashboard:test:staging:
stage: test
tags:
- dashboard_staging
when: manual
before_script:
- echo "do sth"
only:
- staging
except:
changes:
- 'docker/**/*'
- '*.md'
script:
- echo "do sth"
dashboard:test:production:
stage: test
tags:
- dashboard_production
when: manual
before_script:
- echo "do sth"
only:
- staging
except:
changes:
- 'docker/**/*'
- '*.md'
script:
- echo "do sth"
dashboard:build:staging:
stage: build
tags:
- dashboard_staging
only:
- staging
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- echo "do sth"
dashboard:build:production:
stage: build
tags:
- dashboard_production
only:
- staging
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- echo "do sth"
dashboard:deploy:staging:
stage: deploy
tags:
- dashboard_staging
except:
changes:
- 'docker/**/*'
- '*.md'
only:
- staging
before_script:
- echo "do sth"
script:
- echo "do sth"
dashboard:deploy:production:
stage: deploy
tags:
- dashboard_production
except:
changes:
- 'docker/**/*'
- '*.md'
only:
- staging
before_script:
- echo "do sth"
script:
- echo "do sth"
Questions
- How can I resolve this pending issue in
Deploy
stage?
- Is there any way to run the defined tags independently from each other?