Go-CD:如何使用API​​触发管道?

标签 go-cd

是否有API可以用来触发管道,我在API手册中没有找到。或者,有没有其他方法可以使用 linux 命令触发管道?

谢谢

最佳答案

文档链接:https://api.gocd.org/current/#scheduling-pipelines

POST /go/api/pipelines/:pipeline_name/schedule

在请求中,您可以覆盖环境变量、要使用的 Material 并选择在开始前更新 Material 。

来自文档的命令示例:

$ curl 'https://ci.example.com/go/api/pipelines/pipeline1/schedule' \
       -u 'username:password' \
       -H 'Accept: application/vnd.go.cd.v1+json' \
       -H 'Content-Type: application/json' \
       -X POST \
       -d '{
             "environment_variables": [
               {
                 "name": "USERNAME",
                 "secure": false,
                 "value": "bob"
               },
               {
                 "name": "SSH_PASSPHRASE",
                 "value": "some passphrase",
                 "secure": true,
               },
               {
                 "name": "PASSWORD",
                 "encrypted_value": "YEepp1G0C05SpP0fcp4Jh+kPmWwXH5Nq",
                 "secure": true,
               }
             ],
             "materials": [
               {
                 "fingerprint": "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c",
                 "revision": "123"
               },
               {
                 "fingerprint": "7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730",
                 "revision": "1058e75b18e8a645dd71702851994a010789f450"
               }
             ],
             "update_materials_before_scheduling": true
           }'

关于Go-CD:如何使用API​​触发管道?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58637212/

相关文章:

go-cd - 如何重命名 GoCD 管道?

continuous-delivery - 在 GoCD 中自动终止长时间运行的管道

c# - 在 .NET 中使用 Go CD

maven - 无法执行 GO CD 中的 "mvn clean package"任务

mobile - GoCD 部署到 Crashlytics Android 和 IOS

docker - 工作从哪里获取环境变量?

sonarqube - 如何在GoCD中添加 Sonar 扫描仪?

docker - Docker Windows授予对构建代理用户的访问权限

java - 如何在 Go SBT 任务中指定 JVM 标志?

docker - 使用 gocd CI/CD 运行 docker 容器