Gitlab multi-project pipeline, how to trigger a downstream pipeline on a latest tag?

Trying to trigger a pipeline to run test in project B (downstream) from project A. Wanted to know if it is possible to it run on a particular tag in project B. (Currently, it always gets triggered on master which is the default branch.)


Solution 1:

Invoke this command ( from https://docs.gitlab.com/ee/ci/triggers/ )

 curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.example.com/api/v4/projects/9/trigger/pipeline

change ref=master to ref=your_tag, and 9 to project B id.

to get latest tag ( from https://stackoverflow.com/a/1805463/746618)

git describe $(git rev-list --tags --max-count=1)