Running Jobs

Jobs are intended to be triggered from CICD automation tools

We'll asume you have created a Job already, if you want to know how to create a new Job please read this.

There are diverse ways you can use for running Jobs and we're going to cover each in this section.

Webhook calls

Every Job has a webhook id that can be used for easily triggering the Job from anywhere, this webhook call information can be obtained directly from the Job by clicking the button "CICD Integration":

This will open a window where you can copy the command used for triggering the Job

Let's see several ways for calling the webhook:

CURL command

OSX and Linux:

curl -H "X-API-KEY: <API_KEY>" https://app.zirkul.com/api/webhook/<id>

Windows:

curl -H @{'X-API-KEY'='<API_KEY>'} https://app.zirkul.com/api/webhook/<id>

If you want to send variables in your request, use the custom http request header ZIRKUL-VARIABLES as follows.

curl -H "X-API-KEY: <API_KEY>" -H "ZIRKUL-VARIABLES: my_var='the value' " https://app.zirkul.com/api/webhook/<id>

Zirkul Agent CLI

The Agent can be executed as a CLI interactive tool and there are some parameters that allows you to call a webhook with some extended functionalities.

This is a simple command for calling a webhook and wait until the job is completed:

zirkul --agent cicd --server https://app.zirkul.com --webhook <WEBHOOK_ID> --apikey '<API_KEY>' --wait

You can also send custom variables to the Job with the variables option.

The output would be something like this:

Use the option --wait if you want the Agent to wait until the Job is completed, otherwise the command will exit as soon as the webhook call is completed.

See more about webhook calls here.

PowerShell


$headers = @{
    'X-API-KEY' = '<API_KEY>'
}
Invoke-RestMethod -Uri https://app.zirkul.com/api/webhook/<id> -Method Get -Headers $headers

Securing your secrets

It's strongly recommended to store your API Keys in variables instead of hardcoding the values in your pipelines to prevent unauthorized access to secrets.

Last updated