Skip to content
terminal

GitHub Action

Jenkins Job Trigger

1.0 Latest version

Jenkins Job Trigger

terminal

Jenkins Job Trigger

Trigger a Jenkins job

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Jenkins Job Trigger

uses: estherk0/[email protected]

Learn more about this action in estherk0/jenkins-trigger

Choose a version

Jenkins job trigger action

Github Action to trigger jenkins job and wait for job completion using Jenkins API.
Welcome your feedback and request. 👐

Usage

Generate API token for Jenkins API

Please see How to get the API Token for Jenkins

  1. Log in Jenkins.
  2. Click you name (upper-right corner).
  3. Click Configure (left-side menu).
  4. Use "Add new Token" button to generate a new one then name it.
  5. You must copy the token when you generate it as you cannot view the token afterwards.
  6. Revoke old tokens when no longer needed.

Inputs

name required description
url true Jenkins full URL including http/https protocol
user_name true User name of Jenkins
api_token true Jenkins API token
job_name true Jenkins job name
parameter false Job parameter in JSON format. ex) {"param1":"value1"}
headers false Additional headers to include in the HTTP requests in JSON format. ex) {"param1":"value1"}
wait false Set true as default. Waiting for job completion or not
timeout false Set 600 seconds as default. Timeout (seconds) for github action.

Example

- name: Trigger jenkins job
  uses: jabbukka/jenkins-trigger@main
  with:
    url: ${{ secrets.JENKINS_URL }}
    job_name: "build_web_application"
    user_name: ${{ secrets.JENKINS_USER }}
    api_token: ${{ secrets.JENKINS_TOKEN }}
    wait: "true"
    timeout: "1000"