【发布时间】:2020-07-21 12:55:09
【问题描述】:
我有带有 ci 文件的 gitlab 项目:
stages:
- build
- run
build:
stage: build
script:
- (some stuff)
tags:
- my_runner_tag
except:
- triggers
when: manual
run:
stage: run
script:
- (some stuff)
tags:
- my_runner_tag
except:
- triggers
when: manual
每次源代码更改都会创建作业,并且只能使用 gitlab 界面手动运行它们。
现在,我希望有可能使用 Gitlab API 触发阶段run。尝试:
curl -X POST \
> -F token=xxxxxxxxxxxxxxx \
> -F ref=master \
> https://gitlab.xxxxx.com/api/v4/projects/5/trigger/pipeline
返回:
{"message":{"base":["No stages / jobs for this pipeline."]}}
似乎我必须定义要触发的阶段,但我找不到通过 api 调用传递它的方法。
【问题讨论】:
标签: gitlab gitlab-ci pipeline jobs stage