Github Action to trigger jenkins job and wait for job completion using Jenkins API.
Welcome your feedback and request. 👐
Please see How to get the API Token for Jenkins
- Log in Jenkins.
- Click you name (upper-right corner).
- Click Configure (left-side menu).
- Use "Add new Token" button to generate a new one then name it.
- You must copy the token when you generate it as you cannot view the token afterwards.
- Revoke old tokens when no longer needed.
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. |
- name: Trigger jenkins job
uses: abdul-at/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"