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.)
            Asked
            
        
        
            Active
            
        
            Viewed 1,496 times
        
    2 Answers
3
            
            
        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)
 
    
    
        ilia
        
- 1,082
- 11
- 19
0
            
            
        If you have two projects with same tag you can do it like that:
Project A:
tag-job:
  stage: build
  trigger:
    project: project-b-name
    branch: $CI_COMMIT_TAG
    strategy: depend
  only:
    - tags
Project B:
downstream-job:
  stage: build
  rules:
    - if: '$CI_PIPELINE_SOURCE == "pipeline"'
  script:
    - run tests
You can specify any other particular branch in "branch: " variable of tag-job.
 
    
    
        Sergey Lagunov
        
- 1
- 1
