A
A
akdes2020-01-21 17:10:14
GitLab
akdes, 2020-01-21 17:10:14

Gitlab CI start only by tag, but different pipe for each branch, how?

Hi all.
Task:
launching a pipeline when a tag is created. In this case, it is necessary to separate Branches
i.e. create Tag 1.0.0 from dev - one process
and if Tag 1.0.0 from master - another
Attempt:
To respond to the tag added to .gitlab-ci.yml to each stage

only:
        - /^(\d+\.)?(\d+\.)?(\*|\d+)$/

tags like 1.0.0 and it works quite well, but I need to have different tasks depending on the source branch, develop has its own, master has its own, etc.
And here I got up ... I found a bunch of feature_requests, but they are all closed or open without a solution.
Can anyone advise something?
As a last resort, I will make a tag like dev-1.0.0 and master-1.0.0 and catch it in only, but what if there is a better idea?
Gitlab CE 11.6.4 on LAN Thanks in
advance.
UPD: Yes, I know that a commit can be on all branches at the same time, and that the logic of the explanation is not correct. But the task is there. The tag is a kind of trigger, each branch has its own tasks...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Georg Gaal, 2020-02-10
@gecube

1. in the pipeline itself, using variables or direct access to git, you can determine which branch and perform a specific action. The only problem is that it's not very visual. And such a script can be hard to write
off the bat 2. Use extended gitlab syntax:
https://docs.gitlab.com/ee/ci/yaml/#rules or https://docs.gitlab.com/ee/ci/yaml /#onlyexcept-advanced

V
Victor Bomberow, 2020-02-12
@majstar_Zubr

For such a task, you need to translate the conditions specified with only and except using double negatives.
https://gitlab.com/gitlab-org/gitlab-foss/issues/2...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question