Jenkins
Builds authenticate with an ID token your Jenkins signs itself.
Builds authenticate with an ID token your Jenkins signs itself.
What proves the identity
The token has to come from https://ci.acme.com/oidc, and its sub claim has to match the workload you named. penv compares that claim byte for byte, with no wildcards.
Every token also has to name your workspace as its audience. Ask for this audience and no other. A token requested for two audiences fails every exchange.
What the console asks for
| Field | Example | Advanced | What it pins |
|---|---|---|---|
| Jenkins URL | https://ci.acme.com | no | Must be reachable from the internet for us to read its signing keys at /oidc. A folder-scoped credential publishes elsewhere, and connecting tells you the issuer it printed. |
| Subject | https://ci.acme.com/job/api/ | no | The credential's subject, exactly as Jenkins renders it. One containing BUILD_NUMBER matches a single build. |
The console also asks which project and environment this identity reaches and which role it gets, with the credential lifetime behind Advanced.
What the trust holds
Built from the example answers above:
| What | Value |
|---|---|
| Issuer | https://ci.acme.com/oidc |
| Claim compared | sub |
| Subject | https://ci.acme.com/job/api/ |
| Identity name | jenkins-https-ci-acme-com-job-api |
penv names the identity for you, so the form never asks for one.
The snippet the console prints
// Credential 'penv-oidc': set its Audience to YOUR_WORKSPACE_ID
withCredentials([string(credentialsId: 'penv-oidc', variable: 'T')]) {
sh '''
C=$(curl -sS "https://penv.cloud/api/v1/auth/oidc" \
-H 'content-type: application/json' \
-d "{\\"token\\":\\"$T\\"}" | jq -r .credential)
PENV_TOKEN="$C" penv pull
'''
}The snippet finishes with penv pull, which writes a file. penv run is the path the docs teach for a process, and penv pull is for a host that needs a file on disk. Connect your CI has the wrapped step.
Related
- Machine identity
- Connect a Platform in the console
- Jenkins documentation, where the value people get wrong is always the subject