2021年4月23日星期五

In the Gitlab CI yaml file, how do I make one job trigger after completion of any one of other predefined stages?

I'm I am making a gitlab ci yaml file, that prompts one job to run directly after another. I am using the needs parameter to do some, but now I have a use-case where different jobs a can trigger the same specific job, but there is no need to run them both. Completion of any one of these jobs should start the new job. This was what I have so far:

trigger1_tests:    stage: trigger    script:      - echo "TBD"    allow_failure: false    when: manual    trigger2_tests:    stage: trigger    script:      - echo "TBD"    allow_failure: false    when: manual    run_after_trigger:    stage: test    when: on_success    needs:      - trigger1_tests      - trigger2_tests  

The above doesn't do what I want though. It currently waits for both trigger1_test and trigger2_test to complete before running. However, all I want is the completion of any of these two jobs to trigger run_after_trigger. So, I'd like needs to function as if it had an OR operator instead of an AND. So far, | and || don't seem to be syntactically correct, so if there is a way to do this, I'd really appreciate the help!

run_after_trigger:    stage: test    when: on_success    needs: # Need to interpret as OR, not AND      - trigger1_tests OR trigger2_tests  
https://stackoverflow.com/questions/67238451/in-the-gitlab-ci-yaml-file-how-do-i-make-one-job-trigger-after-completion-of-an April 24, 2021 at 09:07AM

没有评论:

发表评论