Kicking off a Jenkins pipeline in a Workflow
Last updated
Was this helpful?
Last updated
Was this helpful?
After integrating Cortex with , you can use a Cortex to kick off your pipeline directly through Cortex, rather than switching to Jenkins to launch a build.
For full instructions on creating and configuring Workflows, see the .
Before getting started:
Generate an API token in Jenkins
In Jenkins, navigate to user settings > Configure > API Token.
Generate a base64-encoded authentication header. After generating the header, copy it and store it in a secure location, as you will need it in the next step.
You can generate the header with a command line tool or a basic authentication tool such as .
If using Mixed Analytics, enter the token into their encoding tool using the format username:token
, replacing username
with the username used to create the Jenkins token and replacing token
with the value of your Jenkins API token.
When using an authentication tool such as Mixed Analytics to generate the authentication header, do not include the equal signs that are appended to the header. For example, if the tool returns xxxxxxxxxx6789==
as the encoded header, you only need to save the value xxxxxxxxxx6789
for the next step.
Navigate to the page and click Add secret.
In the modal, configure the secret:
Name: Enter a descriptive name, such as Jenkins
.
Identifier: Enter a unique identifier for the secret.
Secret value: Enter the base64-encoded authentication header you generated in the previous step.
Click Add secret.
In the main nav of Cortex, click Workflows.
Give the Workflow a descriptive name such as "Kick off Jenkins pipeline."
Click + to view the block library.
Click Jenkins.
To choose a a build without parameters, select Run a build.
To choose a build with parameters, select Run a build with parameters.
Click Insert at the bottom of the library.
In the side panel, configure the block.
Block name: Enter a name for the block (e.g., Run a build in Jenkins
).
Slug: Enter a unique slug for the block.
Jenkins URL: Enter the base URL of your Jenkins server (e.g., https://jenkins.example.com
).
Job name: Enter the name of the Jenkins job to run.
Authentication token: Enter the secret you created in Cortex in the previous steps.
Parameters: For a build with parameters, you also need to configure valid JSON for the run job parameters.
At the bottom of the side panel, click Save.
Follow the steps of the to start creating a Workflow from scratch and configure its settings.
In the Response template field you can pass a blank response body or use to create messages depending on what the user enters in each field.
You can add a block to run a build with parameters, or you can add a block to run a build without parameters. See the Jenkins documentation for .