Skip to content
play

GitHub Action

Jenkins-Action Deluxe

v2 Latest version

Jenkins-Action Deluxe

play

Jenkins-Action Deluxe

Start Jenkins jobs and report back url and status of build

Installation

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

              

- name: Jenkins-Action Deluxe

uses: ftsamis/jenkins-githubaction@v2

Learn more about this action in ftsamis/jenkins-githubaction

Choose a version

Jenkins GitHub Action

Start Jenkins jobs with GitHub actions. Reports back the Jenkins URL and status of the build.

Usage

You need to setup a Jenkins API token if you require authentication with 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.

It's best practice to save the token in GitHub secrets.

Example workflow

name: jenkins-CI

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Trigger jenkins job
        uses: joshlk/jenkins-githubaction@master
        with:
          url: https://jenkins_url
          job_name: jenkins_job_name
          username: ${{ secrets.JENKINS_USER }}
          api_token: ${{ secrets.JENKINS_TOKEN }}
          timeout: "1000"

Inputs

Input Description Default
url Jenkins URL including http/https protocol
job_name Jenkins job name to build
username (optional) Jenkins username
api_token (optional) Jenkins API token
parameters (optional) Build parameters in JSON format e.g. {"field1":"value1"}
cookies (optional) Cookies to include in HTTP requests in JSON format e.g. {"field1":"value1"}
wait (optional) Should the runner wait for the build to finish and provide ok status True
timeout (optional) Timeout in seconds for build to complete 600
start_timeout (optional) Timeout in seconds for build to start 600
interval (optional) ow frequently in seconds to query Jenkins for build status 5

Outputs

Output Description
build_url Jenkins build URL