gitlab - How to trigger a downstream pipeline on a specific runner with Gitlab API?
问题描述
I am trying to trigger another downstream pipeline within my pipeline using the Gitlab API because the projects are private.
I am able to trigger it initially but I keep running into issues when the downstream pipeline starts because it seems that it keeps running on some other random runner.
I've tried the following methods:
run_downstream_pipeline:
stage: trigger_project_b_pipeline
script:
- 'curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=staging \
--form "variables[CI_RUNNER_TAGS]=my_runner_tag" \
"https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"'
...or adding it as a -tag:
run_downstream_pipeline:
stage: trigger_project_b_pipeline
tags:
- my_runner_tag
script:
- 'curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=staging \
"https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"'
...or putting it in as a ref within the url:
run_downstream_pipeline:
stage: trigger_project_b_pipeline
script:
- 'curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=staging \
"https://gitlab.example.com/api/v4/projects/9/ref/my_runner_tag/trigger/pipeline"'
The first and third methods successfully start the downstream pipeline on the wrong runner, but the second method doesn't seem to work at all.
Would appreciate any advice. Thanks!
解决方案
推荐阅读
- r - 不同层和几个netcdf文件的平均值与R
- ios - 呈现的 UIViewController 不能呈现 UIAlertController
- java - 测试后运行 Dataprovider
- firebase - Detected an object of type "Timestamp" that doesn't match the expected instance
- android - 使用已编译的 C 文件为 Android 创建一个 nativescript 插件
- mysql - Mysql:在表中添加列的值
- eclipse - How to make eclipse cdt UI Blocking code run in background and show the result in an editor after finishing the run?
- javascript - 从 Gutenberg SelectControl 获取价值到前端的 php
- assembly - 从 0000:FFFF 读取内容到 AX 寄存器可能会将 CS:IP 更改为 0xf000:e9df
- reactjs - Get max of x axis in highcharts using react