Why triggering manual job is not allowed?

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.

    name: production
    url: some_url
  <<: *my_template
    - if: ($CI_PIPELINE_SOURCE == "trigger")
      when: always
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: manual

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 project-bar.

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 project-bar.

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 deploy_job?

kind regards

1 Like

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.