mirror of
https://github.com/appleboy/drone-jenkins.git
synced 2026-06-04 18:23:57 +08:00
60874908e6
- Add example configurations for build parameters and waiting for job completion - Document new settings: wait, poll_interval, timeout, insecure, and remote_token - Update parameters format to require multi-line key=value pairs (one per line) - Clarify handling of whitespace, empty lines, and multiple equals signs in parameter values - Revise CLI and Docker usage examples to use multi-line parameters format - Update YAML configuration example to use multi-line parameters block Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
113 lines
2.3 KiB
Markdown
113 lines
2.3 KiB
Markdown
---
|
|
date: 2019-10-19T00:00:00+00:00
|
|
title: Jenkins
|
|
author: appleboy
|
|
tags: [ infrastructure, trigger, jenkins ]
|
|
repo: appleboy/drone-jenkins
|
|
logo: jenkins.svg
|
|
image: appleboy/drone-jenkins
|
|
---
|
|
|
|
The Jenkins plugin allows you to trigger Jenkins job automatically. The below pipeline configuration demonstrates simple usage:
|
|
|
|
```yaml
|
|
- name: trigger jenkins job
|
|
image: appleboy/drone-jenkins
|
|
settings:
|
|
url: http://example.com
|
|
user: appleboy
|
|
token: xxxxxxxxxx
|
|
job: drone-jenkins-plugin-job
|
|
```
|
|
|
|
Example configuration with multiple jobs:
|
|
|
|
```diff
|
|
- name: trigger jenkins job
|
|
image: appleboy/drone-jenkins
|
|
settings:
|
|
url: http://example.com
|
|
user: appleboy
|
|
token: xxxxxxxxxx
|
|
job:
|
|
+ - drone-jenkins-plugin-job-1
|
|
+ - drone-jenkins-plugin-job-2
|
|
```
|
|
|
|
Example configuration with jobs in the folder:
|
|
|
|
```diff
|
|
- name: trigger jenkins job
|
|
image: appleboy/drone-jenkins
|
|
settings:
|
|
url: http://example.com
|
|
user: appleboy
|
|
token: xxxxxxxxxx
|
|
+ job: folder_name/job_name
|
|
```
|
|
|
|
It will trigger the URL of Jenkins job like as `http://example.com/job/folder_name/job/job_name/`
|
|
|
|
Example configuration with build parameters:
|
|
|
|
```yaml
|
|
- name: trigger jenkins job
|
|
image: appleboy/drone-jenkins
|
|
settings:
|
|
url: http://example.com
|
|
user: appleboy
|
|
token: xxxxxxxxxx
|
|
job: parameterized-job
|
|
parameters: |
|
|
ENVIRONMENT=production
|
|
VERSION=${DRONE_TAG}
|
|
COMMIT_SHA=${DRONE_COMMIT_SHA}
|
|
```
|
|
|
|
Example configuration with wait for completion:
|
|
|
|
```yaml
|
|
- name: trigger jenkins job and wait
|
|
image: appleboy/drone-jenkins
|
|
settings:
|
|
url: http://example.com
|
|
user: appleboy
|
|
token: xxxxxxxxxx
|
|
job: deploy-job
|
|
wait: true
|
|
poll_interval: 15s
|
|
timeout: 1h
|
|
```
|
|
|
|
## Parameter Reference
|
|
|
|
url
|
|
: jenkins server base url.
|
|
|
|
user
|
|
: jenkins user account
|
|
|
|
token
|
|
: jenkins user token
|
|
|
|
job
|
|
: jenkins job name
|
|
|
|
parameters
|
|
: build parameters in multi-line `key=value` format (one per line)
|
|
|
|
wait
|
|
: wait for job completion (default: false)
|
|
|
|
poll_interval
|
|
: interval between status checks when waiting (default: 10s)
|
|
|
|
timeout
|
|
: maximum time to wait for job completion (default: 30m)
|
|
|
|
insecure
|
|
: allow insecure SSL connections (default: false)
|
|
|
|
remote_token
|
|
: jenkins remote trigger token (alternative to user/token authentication)
|