在Rundeck 3.4.9社区版本中设置Jenkins作业



我想设置一个应该由Rundeck触发的Jenkins作业。我已经安装了Rundeck插件,并测试了Rundec克和Jenkins之间的连接,它正在按预期工作。现在,我的要求是Rundeck应该触发相同的Jenkins作业。我使用的是Rundeck 3.4.9社区版本。

我如何在Rundeck中设置Jenkins作业?我需要在Rundec克和Jenkins端进行哪些配置?

您可以设计一个Rundeck作业,通过CURL使用该端点调用Jenkins作业。

我成功地测试了这个端点:

http://user:JENKINS_USER_TOKEN@localhost:8080/job/TestJob/build

您可以使用http工作流步骤来使用该URL格式发送帖子请求。

来源。

下面是一个工作定义示例:

- defaultTab: nodes
description: ''
executionEnabled: true
id: 1fa2923a-5b1d-4ea2-97d1-4cc2a3726f07
loglevel: INFO
name: ExampleJENKINS
nodeFilterEditable: false
plugins:
ExecutionLifecycle: null
scheduleEnabled: true
sequence:
commands:
- exec: echo "starting..."
- fileExtension: .sh
interpreterArgsQuoted: false
script: curl -vvv -X POST http://admin:11bd72f1f22653cf7158c7961f60476a1d@localhost:8080/job/MyJenkinsJob/build
scriptInterpreter: /bin/bash
keepgoing: false
strategy: node-first
uuid: 1fa2923a-5b1d-4ea2-97d1-4cc2a3726f07

另一种方法是使用配置了基本身份验证的HTTPStep插件。

工作定义示例:

- defaultTab: nodes
description: ''
executionEnabled: true
id: 1fa2923a-5b1d-4ea2-97d1-4cc2a3726f07
loglevel: INFO
name: ExampleJENKINS
nodeFilterEditable: false
plugins:
ExecutionLifecycle: null
scheduleEnabled: true
sequence:
commands:
- exec: echo "starting..."
- configuration:
authentication: Basic
checkResponseCode: 'false'
method: POST
password: keys/jenkins_admin_token
printResponse: 'false'
printResponseToFile: 'false'
proxySettings: 'false'
remoteUrl: http://localhost:8080/job/MyJenkinsJob/build
sslVerify: 'true'
timeout: '30000'
username: admin
nodeStep: true
type: edu.ohio.ais.rundeck.HttpWorkflowNodeStepPlugin
keepgoing: false
strategy: node-first
uuid: 1fa2923a-5b1d-4ea2-97d1-4cc2a3726f07

最新更新