Trigger a presubmit gangway job (typically use GitHub Prow commands instead)
Triggers presubmit gangway jobs via REST API with mandatory user confirmation.
/plugin marketplace add openshift-eng/ai-helpers/plugin install ci@ai-helpers<job-name> <org> <repo> <base-ref> <base-sha> <pr-number> <pr-sha> [ENV_VAR=value ...]ci:trigger-presubmit
/trigger-presubmit <job-name> <org> <repo> <base-ref> <base-sha> <pr-number> <pr-sha> [ENV_VAR=value ...]
The trigger-presubmit command triggers a presubmit gangway job via the REST API.
WARNING: Triggering presubmit jobs via REST is generally unnecessary and not recommended. Presubmit jobs should typically be triggered using Prow commands like /test and /retest via GitHub interactions. Only use this command if you have a specific reason to trigger via REST API.
The command accepts:
It constructs the necessary JSON payload with refs and pulls structure and executes the curl command to trigger the job via the gangway REST API.
IMPORTANT SECURITY REQUIREMENTS:
Claude is granted LIMITED and SPECIFIC access to the app.ci cluster token for the following AUTHORIZED operations ONLY:
oc whoami)Claude is EXPLICITLY PROHIBITED from:
MANDATORY USER CONFIRMATION: Before executing ANY POST operation (job trigger), Claude MUST:
Token Usage:
The app.ci cluster token is used solely for authentication with the gangway REST API. This token grants the same permissions as the authenticated user and must be handled with appropriate care. The curl_with_token.sh wrapper handles all authentication automatically.
The command performs the following steps:
Warn User: Display a warning that presubmit jobs should typically use GitHub Prow commands (/test, /retest)
Parse Arguments:
Construct JSON Payload: Build the payload with refs and pulls structure:
Without overrides:
{
"job_name": "<JOB_NAME>",
"job_execution_type": "3",
"refs": {
"org": "<ORG>",
"repo": "<REPO>",
"base_ref": "<BASE_REF>",
"base_sha": "<BASE_SHA>",
"pulls": [{
"number": <PR_NUMBER>,
"sha": "<PR_SHA>",
"link": "https://github.com/<ORG>/<REPO>/pull/<PR_NUMBER>"
}]
}
}
With overrides:
{
"job_name": "<JOB_NAME>",
"job_execution_type": "3",
"refs": {
"org": "<ORG>",
"repo": "<REPO>",
"base_ref": "<BASE_REF>",
"base_sha": "<BASE_SHA>",
"pulls": [{
"number": <PR_NUMBER>,
"sha": "<PR_SHA>",
"link": "https://github.com/<ORG>/<REPO>/pull/<PR_NUMBER>"
}]
},
"pod_spec_options": {
"envs": {"ENV_VAR": "value"}
}
}
Save JSON to Temporary File: Write the payload to a temp file (e.g., /tmp/presubmit-spec.json)
Request User Confirmation: Display the complete JSON payload and curl command to the user, then explicitly ask for confirmation before proceeding. Wait for affirmative user response.
Execute Request: Only after receiving user confirmation, run the curl command using the oc-auth skill's curl wrapper:
# Use curl_with_token.sh from oc-auth skill - it automatically adds the OAuth token
# app.ci cluster API: https://api.ci.l2s4.p1.openshiftapps.com:6443
curl_with_token.sh https://api.ci.l2s4.p1.openshiftapps.com:6443 -v -X POST \
-d @/tmp/presubmit-spec.json \
https://gangway-ci.apps.ci.l2s4.p1.openshiftapps.com/v1/executions
The curl_with_token.sh wrapper retrieves the OAuth token from the app.ci cluster and adds it as an Authorization header automatically, without exposing the token.
Clean Up: Remove the temporary JSON file
Display Results: Show the API response including the execution ID
Offer Follow-up: Optionally offer to query the job status using /query-job-status
Important for Claude:
ci:oc-auth skill is loaded by invoking it with the Skill tool. The curl_with_token.sh script depends on this skill being active./query-job-statusTrigger a presubmit job without overrides:
/trigger-presubmit pull-ci-openshift-origin-master-e2e-aws openshift origin master abc123def456 1234 def456ghi789
Trigger a presubmit job with environment override:
/trigger-presubmit my-presubmit-job openshift installer master 1a2b3c4d 5678 4d5e6f7g RELEASE_IMAGE_INITIAL=quay.io/image:test
Trigger with multiple environment overrides:
/trigger-presubmit pull-ci-test openshift cluster-version-operator master abcdef12 999 fedcba98 MULTISTAGE_PARAM_OVERRIDE_TIMEOUT=5400 TEST_SUITE=custom
/test <job-name>, /retest) instead of this REST API"3"https://github.com/<org>/<repo>/pull/<pr-number>