Loading
Add the bench:smoke job and the workload identity token script
What
The weekly bench needs to reach Google from CI with no stored key. This adds the token path and a manual smoke job that proves it end to end before the real bench job is built.
ci/gcp_wif_token.shtrades the job's OIDC token at Google STS, impersonates the bench service account, and writes the access token to a mode 0600 file. It prints the path and the expiry only.bench:smokeis a manual job. It runs gitlab-simulationpreflight,upanddownon one bare VM in hosted mode (SIM_LAB_SERVICE_ACCOUNT=none,SIM_FIREWALL=verify) withSIM_OWNER=offline-lab-bench, so the budget label sees every VM.after_scriptrunsdownagain for the same instance name,olb-<pipeline id>.docs/MAINTAINING.mdsection 1c names the CI variables, the label, and how to start the job.
Token path
sequenceDiagram
participant Job as CI job
participant STS as Google STS
participant IAM as iamcredentials
participant File as token file (0600)
participant Sim as gitlab-simulation
participant GCE as Compute Engine
Job->>Job: id_tokens gives GCP_ID_TOKEN
Job->>STS: token exchange (audience = provider)
STS-->>Job: federated token
Job->>IAM: generateAccessToken for the service account
IAM-->>Job: access token, 1 hour
Job->>File: write token, print path and expiry only
Job->>Sim: CLOUDSDK_AUTH_ACCESS_TOKEN_FILE
Sim->>GCE: preflight, up, downHow to run it
Start a pipeline from Build > Pipelines > Run pipeline on main, then play bench:smoke. The provider accepts only this project, main, a protected ref, and pipeline source schedule or web. A pipeline started through the API has source api and the exchange is refused.
Checks
scripts/test_gcp_wif_token.pyruns the script against a local stub of STS and iamcredentials. It asserts the file mode, that no token or JWT reaches stdout or stderr, and that an STS refusal exits non-zero with a readable message. All five tests fail without the script.scripts/test_ci_config.pyasserts thatbench:smokehasid_tokens, is absent from merge request pipelines, and has anafter_scriptthat callsdown. All six tests fail without the job.- Both run in
pins:lint. The script passes shellcheck. The script was not run against Google endpoints.
Notes
- The job image is the official Google Cloud CLI image, pinned by tag and digest. gitlab-simulation is cloned at a pinned commit, and mise is downloaded at a pinned version with a checked SHA-256.
- gitlab-simulation's preflight needs mise, just, jq, glab and gcloud on the path. The job installs just and glab with mise.
- The role's permission list was derived, and 8 provider verbs are not confirmed by a live run. The first smoke run may name a missing permission. Report it. Do not widen the role to get past it.