News for hackers. Stuff that matters.
Re:Jenkins Is Getting Old by chinhodado on Monday April 29, 2019 @07:25PM (#19783599)
I'm not sure that's what I needed. For example, I wanted to trigger a job only for a merge request, and only if the target branch of the merge request is e.g. master. Is that possible? Trigger a job only for a MR is possible, but I don't know how to further do the later branch filtering.
Re:Jenkins Is Getting Old by cpitman on Monday April 29, 2019 @09:07PM (#19784206)
When using a merge_request pipeline, GitLab defines additional variables for the run. That includes `CI_MERGE_REQUEST_TARGET_BRANCH_NAME`.

So it would look something like this:

  job:
    only:
      refs:
        - merge_requests
      variables:
        - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
Re:Jenkins Is Getting Old by chinhodado on Tuesday April 30, 2019 @08:34AM (#19787321)
Oh wow I didn't know you can do conditionals with variable like that. I'll give it a try later, thanks!
Re:Jenkins Is Getting Old by saidmasoud on Saturday May 04, 2019 @05:49PM (#19829606)
We generally only merge into master at my org, but I didn't know you could conditionally trigger jobs using an equality expression on a GitLab-provided variable. I'll have to keep this in the back pocket for future reference, thanks! Any docs that describe this feature in more detail?