Skip to content

appleboy/jenkins-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Trigger Jenkins Job for GitHub Actions

GitHub Action for trigger jenkins jobs.

jenkins

Usage

Trigger New Jenkins Job.

name: trigger jenkins job
on: [push]
jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
    - name: trigger single Job
      uses: appleboy/jenkins-action@master
      with:
        url: "http://example.com"
        user: "example"
        token: ${{ secrets.TOKEN }}
        job: "foobar"

Jenkins Setting

Setup the Jenkins server using the docker command:

docker run \
  --name jenkins-docker \
  -d --restart always \
  -p 8080:8080 -p 50000:50000 \
  -v /data/jenkins:/var/jenkins_home \
  jenkins/jenkins:lts

Please make sure that you create the /data/jenkins before starting the Jenkins.

Go to user profile and click on Configure:

jenkins

Example

Trigger multiple jenkins job:

- name: trigger multiple Job
  uses: appleboy/[email protected]
  with:
    url: http://example.com
    user: example
    token: ${{ secrets.TOKEN }}
    job: job_1,job_2

Trigger jenkins job with parameter:

- name: trigger Job with parameter
  uses: appleboy/[email protected]
  with:
    url: http://example.com
    user: example
    token: ${{ secrets.TOKEN }}
    job: job_1
    parameters: param1=value1,param2=value2

Input variables

  • url - Required. jenkins base url.
  • user - Required. jenkins user.
  • job - Required. jenkins job name.
  • token - Required. jenkins api token.
  • insecure - Optional. Allow insecure server connections when using SSL. Default is false.
  • parameters - Optional. jenkins job parameter, example: param1=value1,param2=value2.