Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Last I checked, there were a lot of little things that made it not possible to move to GitLab CI. E.g.:

- Can't customize your git checkout process (e.g. shallow clone with depth, or merging source branch with target branch with certain strategy)

- Can't make job run/not run based on filter on source branch/target branch/etc. of a merge request

- Can't dynamically make certain jobs only run on certain agent machines

So I'm still stuck with Jenkins for now. I know we love bashing Jenkins but I have yet to come across anything that offers the same amount of flexibility.



You can definitely do all of your requirements, but likely as a result of recent features

1) you can customise the git checkout depth and style: https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning https://docs.gitlab.com/ee/ci/yaml/#git-strategy

2) https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-basic

3) https://docs.gitlab.com/ee/ci/yaml/#tags

I'm not associated with gitlab at all but happy to give pointers if anyone wants to contact me direct


2) was released in October, about six months ago [0]. I'd also like to add: as a user of GitLab for about a year now, their steady rate of feature releases has bene pretty pleasant, even if I can't take advantage of some right away.

[0] https://about.gitlab.com/2018/10/22/gitlab-11-4-released/#ru...


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.


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"


Oh wow I didn't know you can do conditionals with variable like that. I'll give it a try later, thanks!


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?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: