Jenkins
In Jenkins, Cimon Attest is performed using the CLI. In the first step, you must install Cimon CLI and then attest the artifact that is created. Jenkins supports Cimon on all major pipeline types - "Freestyle project", "Pipeline", and "Multibranch Pipeline".
- Freestyle
- Pipeline
- Docker Agent
curl -sSfL https://cimon-releases.s3.amazonaws.com/install.sh | sh
mkdir dist
echo artifact1 > dist/artifact1
echo artifact2 > dist/artifact2
openssl genrsa -out private-key.pem 3072
./bin/cimon attest attest generate-and-sign \
--client-id $CIMON_CLIENT_ID --secret $CIMON_SECRET \
--subjects "dist/artifact1 dist/artifact2" --key private-key.pem
cat provenance.intoto.jsonl
cat provenance.intoto.jsonl.sig
Explanation:
Running Freestyle Jenkins jobs is less recommended because the script isn't version-controlled, making it hard to create trust in the running build.
curl -sSfL https://cimon-releases.s3.amazonaws.com/install.sh | sh
Installing Cimon tooling.
mkdir dist
echo artifact1 > dist/artifact1
echo artifact2 > dist/artifact2
Creating artifacts. This is build-specific, and we just used stub artifacts for the process demonstration.
openssl genrsa -out private-key.pem 3072
Creating a signature key. This is build-specific, and we just used a stub key for the process demonstration.
./bin/cimon attest attest generate-and-sign \
--client-id $CIMON_CLIENT_ID --secret $CIMON_SECRET \
--subjects "dist/artifact1 dist/artifact2" --key private-key.pem
Attesting the artifacts given through input variables with the provided key. These can be configured through the CLI parameters.
cat provenance.intoto.jsonl
cat provenance.intoto.jsonl.sig
Printing the attestation according to the default paths. These can be configured through the CLI parameters.
pipeline {
agent any
environment {
CIMON_CLIENT_ID = credentials("cimon-client-id")
CIMON_SECRET = credentials("cimon-secret")
}
options {
disableConcurrentBuilds()
}
stages {
stage('Install Cimon') {
steps {
sh 'curl -sSfL https://cimon-releases.s3.amazonaws.com/install.sh | sh'
}
}
stage('Build Artifacts') {
steps {
sh """
mkdir dist
echo artifact1 > dist/artifact1
echo artifact2 > dist/artifact2
"""
}
}
stage('Generate Sign Key') {
steps {
sh """
openssl genrsa -out private-key.pem 3072
"""
}
}
stage('Cimon Attest') {
steps {
sh """
cimon attest generate-and-sign \
--client-id $CIMON_CLIENT_ID --secret $CIMON_SECRET \
--subjects "dist/artifact1 dist/artifact2" --key private-key.pem
"""
}
}
stage('Print Provenance') {
steps {
sh 'cat provenance.intoto.jsonl'
}
}
stage('Print Signed Provenance') {
steps {
sh 'cat provenance.intoto.jsonl.sig'
}
}
}
}
Explanation:
When running a pipeline job, it is recommended to pull the Jenkinsfile
from a version-controlled system. This improves the provenance quality and makes trusting the running build easier.
environment {
CIMON_CLIENT_ID = credentials("cimon-client-id")
CIMON_SECRET = credentials("cimon-secret")
}
The credentials must be loaded into the environment variables.
options {
disableConcurrentBuilds()
}
Enforce steps to run sequentially.
stage('Install Cimon') {
steps {
sh 'curl -sSfL https://cimon-releases.s3.amazonaws.com/install.sh | sh'
}
}
Installing Cimon tooling. More info for installation options can be found in CLI integration page.
stage('Build Artifacts') {
steps {
sh """
mkdir dist
echo artifact1 > dist/artifact1
echo artifact2 > dist/artifact2
"""
}
}
Creating artifacts. This is build-specific, and we just used stub artifacts for the process demonstration.
stage('Generate Sign Key') {
steps {
sh """
openssl genrsa -out private-key.pem 3072
"""
}
}
Creating a signature key. This is build-specific, and we just used a stub key for the process demonstration.
stage('Cimon Attest') {
steps {
sh """
cimon attest generate-and-sign \
--client-id $CIMON_CLIENT_ID --secret $CIMON_SECRET \
--subjects "dist/artifact1 dist/artifact2" --key private-key.pem
"""
}
}
Attesting the artifacts given through input variables with the provided key. These can be configured through the CLI parameters.
stage('Print Provenance') {
steps {
sh 'cat provenance.intoto.jsonl'
}
}
stage('Print Signed Provenance') {
steps {
sh 'cat provenance.intoto.jsonl.sig'
}
}
Printing the attestation according to the default paths. These can be configured through the CLI parameters.
pipeline {
agent {
docker {
image 'ubuntu:22.04'
args '--user="root"'
}
}
environment {
CIMON_CLIENT_ID = credentials("cimon-client-id")
CIMON_SECRET = credentials("cimon-secret")
}
options {
disableConcurrentBuilds()
}
stages {
stage('Install Cimon') {
steps {
sh 'apt update && apt install curl -y'
sh 'curl -sSfL https://cimon-releases.s3.amazonaws.com/install.sh | sh'
}
}
stage('Build Artifacts') {
steps {
sh """
mkdir dist
echo artifact1 > dist/artifact1
echo artifact2 > dist/artifact2
"""
}
}
stage('Generate Sign Key') {
steps {
sh """
openssl genrsa -out private-key.pem 3072
"""
}
}
stage('Cimon Attest') {
steps {
sh """
cimon attest generate-and-sign \
--client-id $CIMON_CLIENT_ID --secret $CIMON_SECRET \
--subjects "dist/artifact1 dist/artifact2" --key private-key.pem
"""
}
}
stage('Print Provenance') {
steps {
sh 'cat provenance.intoto.jsonl'
}
}
stage('Print Signed Provenance') {
steps {
sh 'cat provenance.intoto.jsonl.sig'
}
}
}
}
Explanation:
When running a pipeline job, it is recommended to pull the Jenkinsfile
from a version-controlled system. This improves the provenance quality and makes trusting the running build easier.
environment {
CIMON_CLIENT_ID = credentials("cimon-client-id")
CIMON_SECRET = credentials("cimon-secret")
}
The credentials must be loaded into the environment variables.
options {
disableConcurrentBuilds()
}
Enforce steps to run sequentially.
stage('Install Cimon') {
steps {
sh 'apt update && apt install curl -y'
sh 'curl -sSfL https://cimon-releases.s3.amazonaws.com/install.sh | sh'
}
}
Installing Cimon tooling. More info for installation options can be found on the CLI integration page.
stage('Build Artifacts') {
steps {
sh """
mkdir dist
echo artifact1 > dist/artifact1
echo artifact2 > dist/artifact2
"""
}
}
Creating artifacts. This is build-specific, and we just used stub artifacts for the process demonstration.
stage('Generate Sign Key') {
steps {
sh """
openssl genrsa -out private-key.pem 3072
"""
}
}
Creating a signature key. This is build-specific, and we just used a stub key for the process demonstration.
stage('Cimon Attest') {
steps {
sh """
cimon attest generate-and-sign \
--client-id $CIMON_CLIENT_ID --secret $CIMON_SECRET \
--subjects "dist/artifact1 dist/artifact2" --key private-key.pem
"""
}
}
Attesting the artifacts given through input variables with the provided key. These can be configured through the CLI parameters.
stage('Print Provenance') {
steps {
sh 'cat provenance.intoto.jsonl'
}
}
stage('Print Signed Provenance') {
steps {
sh 'cat provenance.intoto.jsonl.sig'
}
}
Printing the attestation according to the default paths. These can be configured through the CLI parameters.
Usage
The supported parameters that could be supplied to Cimon are explained in the CLI integration.