-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DOCS] Jenkins docs for signing and verifying using a Jenkins pipeline #303
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JasonPowr, lance The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
docs/sign_and_verify_jenkins.md
Outdated
### Configuring Jenkins | ||
To ensure the pipeline operates smoothly, the following Jenkins configurations are necessary: | ||
|
||
1) Install the Docker Pipeline Plugin: Verify that the Docker Pipeline plugin is installed and enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can links to the plugins be added?
docs/sign_and_verify_jenkins.md
Outdated
-d "grant_type=password" \ | ||
-d "scope=openid" \ | ||
-d "client_id=${env.OIDC_CLIENT_ID}" \ | ||
${env.OIDC_ISSUER_URL}/protocol/openid-connect/token | sed -E 's/.*"access_token":"([^"]*)".*/\\1/' > token.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${env.OIDC_ISSUER_URL}/protocol/openid-connect/token | sed -E 's/.*"access_token":"([^"]*)".*/\\1/' > token.txt | |
${env.OIDC_ISSUER_URL}/protocol/openid-connect/token | sed -E 's/.*"id_token":"([^"]*)".*/\\1/' > token.txt |
docs/sign_and_verify_jenkins.md
Outdated
-d "client_id=${env.OIDC_CLIENT_ID}" \ | ||
${env.OIDC_ISSUER_URL}/protocol/openid-connect/token | sed -E 's/.*"access_token":"([^"]*)".*/\\1/' > token.txt | ||
cosign sign -y --fulcio-url=${env.FULCIO_URL} --rekor-url=${env.REKOR_URL} --oidc-issuer=${env.OIDC_ISSUER_URL} --oidc-client-id=${env.OIDC_CLIENT_ID} --identity-token=token.txt ${env.IMG}:${env.TAG} | ||
cosign verify --rekor-url=${env.REKOR_URL} --certificate-identity-regexp ${env.OIDC_USERNAME} --certificate-oidc-issuer-regexp ${env.OIDC_ISSUER} ${env.IMG}:${env.TAG} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use the --certificate-identity
flag since we know the concrete identity
docs/sign_and_verify_jenkins.md
Outdated
stage("Sign & Verify Image") { | ||
agent { | ||
docker { | ||
image 'registry.redhat.io/rhtas-tech-preview/cosign-rhel9:0.0.2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
image 'registry.redhat.io/rhtas-tech-preview/cosign-rhel9:0.0.2' | |
image 'registry.redhat.io/rhtas/cosign-rhel9:1.0.0' |
docs/sign_and_verify_jenkins.md
Outdated
4) Install the Credentials Plugin: Make sure the Credentials plugin is installed and enabled. | ||
|
||
#### Setting Up Credentials | ||
Credentials will need to be set using the credentials plugin, there are three in total that will need to be configured. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Credentials will need to be set using the credentials plugin, there are three in total that will need to be configured. | |
Credentials will need to be set using the credentials plugin. There are three credentials in total that will need to be configured. |
docs/sign_and_verify_jenkins.md
Outdated
* Set an ID for these credentials; for ease, you can use `redhat_io_credentials` as the default ID. | ||
|
||
* Cosign Credentials | ||
* During the cosign signing process, cosign pushes the signed image to an image registry, because of this it needs credentials, which should be setup in a similar fashion to the above, in the example quay is the registry used and credentials (ID is defaulted to `quay_credentials`) are configured like so: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* During the cosign signing process, cosign pushes the signed image to an image registry, because of this it needs credentials, which should be setup in a similar fashion to the above, in the example quay is the registry used and credentials (ID is defaulted to `quay_credentials`) are configured like so: | |
* During the cosign signing process, cosign pushes the signed image to an image registry. As a result, credentials are needed which should be setup in a similar fashion to the above. In this example, quay.io is the registry used and credentials (ID is defaulted to `quay_credentials`) are configured like so: |
docs/sign_and_verify_jenkins.md
Outdated
``` | ||
|
||
* OIDC Password | ||
* A password, for the OIDC provider will also need to be configured using the credentials plugin (ID is defaulted to `oidc-password`) this should be setup in a similar fashion to the above, but it should be created as a `Secret text` as opposed to a `Username with Password` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* A password, for the OIDC provider will also need to be configured using the credentials plugin (ID is defaulted to `oidc-password`) this should be setup in a similar fashion to the above, but it should be created as a `Secret text` as opposed to a `Username with Password` | |
* A password for the OIDC provider will also need to be configured using the credentials plugin (ID is defaulted to `oidc-password`). This should be setup in a similar fashion to the above, but it should be created as a `Secret text` as opposed to a `Username with Password` |
docs/sign_and_verify_jenkins.md
Outdated
|
||
|
||
#### Setting Up A Pipeline | ||
To Create a pipeline, Dashboard > New item > Pipeline, Pipelines can be created using scm (Source Control Managment) but in this example we use a simple pipeline script, that signs and verify's an image, this example can be found below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To Create a pipeline, Dashboard > New item > Pipeline, Pipelines can be created using scm (Source Control Managment) but in this example we use a simple pipeline script, that signs and verify's an image, this example can be found below. | |
To Create a pipeline, select Dashboard > New item > Pipeline. Pipelines can be created using scm (Source Control Management), but in this example, we use a simple pipeline script that signs and verify's an image. An example can be found below. |
376c6b0
to
387290c
Compare
I've had to update how the pipeline uses cosign credentials, as When deploying this it wasn't working (this time), I believe previously the config for docker within the pipeline was already authenticated with quay, meaning it was skipping the setp each time |
@JasonPowr what is the status of this PR? |
@lance This pr should be good to go, although there may be better documentation out there by now |
Small doc related pr