Zirkul DevSecOps
  • Welcome
  • DevSecOps
    • Getting started
    • Creating Jobs
    • Running Jobs
    • Azure DevOps Pipelines
    • Jenkins Pipelines
    • Job Script Syntax
    • Script templates
  • Zirkul Agent
    • Running the Agent
      • Command Line Interface
    • Command reference
      • Help
      • Clear
      • Var
      • Vars
      • Print
      • Date
      • Now
      • UTCNow
      • Day
      • Month
      • Year
      • Hour
      • Minute
      • Second
      • Env
      • Is base64
      • To base64
      • From base64
    • Scanner signatures
Powered by GitBook
On this page
  1. DevSecOps

Jenkins Pipelines

PreviousAzure DevOps PipelinesNextJob Script Syntax

Last updated 2 years ago

Zirkul Jobs can be executed from Jenkins Pipelines simply by making webhook calls, however you have to make sure the API Key is protected and avoid hardcoding any secret in your pipeline scripts.

Let's start by storing the Zirkul API Key in Jenkins Credentials manager:

Add a new credential scoped to the project folder:

The kind of secret is "Secret text", in the secret section you can paste the API Key value and use the ID zirkul_apikey (for convenience in this guide):

You can then use the secret within the pipeline script in the following way:

Here's the pipeline script:

pipeline {
    agent any

    stages {
        stage('Hello') {
            steps {
                withCredentials([string(credentialsId: 'zirkul_apikey', variable: 'zirkul_apikey')]) {
                    sh 'curl -H "X-API-KEY: $zirkul_apikey" https://app.zirkul.com/api/webhook/f3f75cca-da48-4720-be53-8c0396ca041e'
                }
            }
        }
    }
}

Once you run the pipeline, the console output should look like this:

Note:

  • The API Key is protected and is not included in the logs

  • The webhook call returned the message "Success"

Note you may need to update the webhook id with the .

URL provided by Zirkul for your Job