I'm new to gitlab CI so I'm still trying to get my head around it but I'm wondering if it's possible to do the following?
Developers work in REPO A
QA work in REPO B
When the pipeline from REPO A kicks off is it possible to have it trigger the pipeline from REPO B with a command and pass variables?
That way Developers in REPO A can work on their part of the project e.g. login form but REPO B can contain the entire end to end suite of tests for all features, so if a new team is formed and work on REPO C they can also trigger tests in REPO B.
This would mean QA always work in one repo, and if another repo wants to do a deployment they can call their subset of tests but nightly REPO B can run the full end to end suite with different browsers, devices etc.
Yes, you can use the rules syntax. You can use this in combination with regex for commit message, ci_pipeline_source or any other available CI variables. In doing this you can compose the jobs/pipelines you want in its own yml file and then define the jobs using those templates in the gitlab-ci.
No, you can't have multiple gitlab-ci files per repository.
GitLab provides a method to make clones of a job and run them in parallel for faster execution using the parallel: keyword.
There is the concept of Multi-Project Pipelines which exactly allow your desired behaviour.
See https://docs.gitlab.com/ee/ci/multi_project_pipelines.html#creating-multi-project-pipelines-from-gitlab-ciyml
In your case this would be in Project A and C
externalTest:
variables:
ENVIRONMENT: aVariableValue
stage: deploy
trigger: my-namespace/repo-b
There is a way in the documents of Triggering pipelines through the API which gives us the ability of triggering another pipeline using GitLab API in the current running pipeline:
This way of triggering can only be used when invoked inside .gitlab-ci.yml, and it creates a dependent pipeline relation visible on the pipeline graph. For example:
build_docs: stage: deploy script: - curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.example.com/api/v4/projects/9/trigger/pipeline only: - tags
Pipelines triggered that way also expose a special variable:
CI_PIPELINE_SOURCE=pipeline
.
If you want to trigger REPO B pipeline from REPO A and REPO C, please remember that you must replace the REPO B project id in the above URL instead of example id.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With