Integrate Cortex Cloud Application Security with your Jenkins server to allow dynamic, automated, and context-specific code scans across your codebase. This integration provides continuous scanning of your workflows, triggered by code changes or pipeline events, ensuring security checks are performed and issues are detected as early as possible.
Code scans are executed using the Cortex CLI, and include automated shift-left actions based on scan results.
Note
Jenkins onboarding offers both code and CI/CD scanning. A single integrated instance supports either code or CI scanning, but not both. If you require both code and CI scanning for your Jenkins servers, you must create two separate integrations, selecting the appropriate scanning type for each. To onboard Jenkins for CI/CD scans, refer to Jenkins for CI/CD pipeline scans.
Prerequisite
Grant Administrator permissions to the user integrating Cortex Cloud Application Security with Jenkins
Onboarding steps
On the Cortex Cloud console:
Search for and hover over Jenkins and click Add, or Add Another Instance if an instance is already onboarded.
On the Select Integration step of the Jenkins integration, select → .
On the Add Environment Variables step of the wizard.
Select .
The API key secret and API key ID values are generated and populate their respective fields.
Select your system architecture.
Click .
Store your Cortex Cloud API Key and API ID in the Jenkins Credentials store.
Danger
For Cortex Cloud Application Security CI tools, you must store secrets in Jenkins Credentials for use in your Jenkins pipelines using either of these methods:
Plain text storage: Store secrets directly as plain text in Jenkins Credentials. Access them in your pipeline using the
credentialsfunction, which retrieves the secret directly as plain textCredentials Binding Plugin: Use the
withCredentialsfunction (requires installing the Credentials Binding Plugin) to securely bind credentials to environment variables within your pipeline
The variable names CORTEX_API_KEY and CORTEX_API_KEY_ID must be used exactly as provided. They are part of a predefined system and cannot be changed without causing errors
If you have an API key:
Copy the CORTEX_API_KEY and CORTEX_API_KEY_ID variable names from their respective fields in the wizard.
Add the CORTEX_API_KEY and CORTEX_API_KEY_ID names and their corresponding values as separate environment variables (secrets) to the Jenkins Credentials store.
If you do not have an API key:
→ .
Add the CORTEX_API_KEY and CORTEX_API_KEY_ID names and their corresponding values as separate environment variables (secrets) to the Jenkins Credentials store.
On the Set repository step of the wizard: (Optional): → .
Note
This step is only required for new pipelines
For private repositories, ensure the necessary credentials are configured in Jenkins Credentials
On the Configure Subscription step of the integration wizard.
Copy and paste the code from the Configure Subscription step of the integration wizard into your Jenkins pipeline.
In the
labelsproperty of your Jenkins configuration file, enter the label of a Jenkins node that is configured with Docker.Note
This ensures your build runs within a Docker environment. If a node without Docker is used, the build will fail.
Optional: The provided code assumes that your Cortex Cloud access key and ID are stored as plain text in Jenkins Credentials. You can replace this method with your preferred secret management solution (such as the
withCredentialsfunction).Click .
→ .
Verify integration and confirm that the your integrated Jenkins instance has a status of Connected.
On the Data Sources & Integrations page, search for Jenkins in the search bar.
Hover over and select the resulting entry.
Locate and verify that the status of your instance is Connected.
Next step: View scan results and mitigate issues.
Jenkins code scan workflow template (without checkout)
This Jenkins workflow example automates code scanning using the Cortex CLI. It does not include a step to checkout a repository. The workflow contains placeholder values (often in brackets) and generic terms (such as dev) that you must replace with your environment-specific information before use.
Jenkins code scan workflow template (with checkout)
This Jenkins workflow example automates code scanning using the Cortex CLI. It includes a step to checkout a repository. The workflow contains placeholder values (often in brackets) and generic terms (such as dev) that you must replace with your environment-specific information before use.
Manage data source integrations
Manage integrations to align with evolving requirements and ensure they remain current.
Navigate to → and use the Vendor filter to located the required integration.
Select your vendor from the list.
The integrated instances for the selected vendor are displayed.
Right-click on an instance and select an option:
: Redirects to the Select Repositories step of the integration wizard, where you can modify configurations for the selected instance. For more details, refer to the relevant integration guide
: When confirmed, deletes the instance, including data from previous scans
Copy entire row – Copies all column values for the selected row to the clipboard.