Christopher Thomas
Christopher Thomas

Reputation: 4723

Gitlab CI Job matrix when manual requires each combination to be manually triggered

So I've got a problem where a gitlab ci job matrix is required to run manually. But the problem is, when I use when: manual or a set of rules to determine the same thing, each combination of the pipeline gets its own button to trigger independently.

This isn't ideal because it allows the user to trigger one, but not all, so servers that are redundantly deployed, might have their software updated because somebody pushed the button. But another server in the matrix might not be updated.

So what I want, or need, is that the entire matrix of is manually triggered at once. Instead of one by one. Does anybody know how I can do that?

Upvotes: 3

Views: 1628

Answers (1)

Christopher Thomas
Christopher Thomas

Reputation: 4723

This isn't really an answer, but it's a solution for anybody else who is having the same problem. If in the future there is a proper solution. Let me know.

I wrote this on a gitlab issue I found here: https://gitlab.com/gitlab-org/gitlab/-/issues/330013

Here is what I found I could do:

stages:
 - approval
 - deploy

approval:
  stage: approval
  script:
    - echo ">>>>>>>>>>>>>>> Start DEPLOYMENT >>>>>>>>>>>>>>>"
  when: manual
  allow_failure: false

deploy:
  stage: deploy
  dependencies:
    - approval
  variables:
    SOMETHING: value
  parallel:
    matrix:
      - ANOTHER:
          - this
          - that

Then you get one button in a prior stage which the deploy stage requires to trigger all the pipelines to run. I would prefer an option on the parallel:matrix object to configure this to deploy one by one or the entire group, but I don't have any suggestions for how to do this yet.

Upvotes: 3

Related Questions