Hi, I have very small question regarding triggering manual jobs*
I have a job that deploy manually to an environmnet, I am building a monitoring pipeline, which needs to trigger the manual job (execute it automatically).
I don’t want to change the manual deployment just because of the monitoring pipeline. It should be seemless. I couldn’t find any API that will trigger manual job.
- if: ($CI_PIPELINE_SOURCE == "trigger")
- if: '$CI_COMMIT_BRANCH == "main"'
Is there a way to do such thing or this is not supported by GitLab?
If i understood correctly you are trying to execute a manual job from a pipeline in
project-foo from a job withing a pipeline in
If you know the Job ID and the ID of
project-foo you could call
POST /projects/:id/jobs/:job_id/play from the job within the pipeline within
When you do not have the ID of the job or the project explicitly you must search for it within the job of
project-bar also using the API.
The “user” that calls the
POST has to have the necessary rights to run the job though. You do not need a user explicitly. Group or project Access Tokens are perfectly viable for that.
What i don’t really understand though conceptually: Are you really creating a pipeline for monitoring purposes that will deploy changes to a production environment that were not deployed by the original pipeline themselves?
Why? In my opinion monitoring generally should only watch and report and have no impact an an environment.
If you are creating the pipeline because there are cases where sometimes the changes were not deployed to production because the pipeline was started by a commit (merge request, direct push to main) and not by a
trigger, why don’t you just change the rules of the
Thank you replying. I really missed the idea that monitoring should just watch. The monitor pipeline is supposed to trigger the original pipeline’s deploy to prod which is currently manual if certain checks failed.
So, you want it to deploy automatically if the checks pass, but only manually if the checks fail? That seems possible from the original CI without getting another pipeline involved.