konflux-build
Skill551 starsChanged 6 months agoApache-2.0View on GitHub
Create a manual Konflux build from a PR with configurable image expiry (default 30 days)
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- api/AGENTS.mdAGENTS.md
- control-plane-operator/AGENTS.mdAGENTS.md
- .cursor/rules/100-go-mistakes.mdcCursor rule
- .cursor/rules/code-formatting.mdcCursor rule
- .cursor/rules/code-review.mdcCursor rule
- .cursor/rules/create-jira-items.mdcCursor rule
- .cursor/rules/debug-aro-hcp-e2e.mdcCursor rule
- .cursor/rules/git-commit-format.mdcCursor rule
- .cursor/rules/restructure-commits.mdcCursor rule
- create-cpo-overrideSkill
- Debug ClusterSkill
- e2e-analyzeSkill
- Effective GoSkill
- feature-developmentSkill
- fix-hypershift-repo-robot-prSkill
- Git Commit FormatSkill
- Konflux Archived PipelineRunsSkill
- pr-reportSkill
- restructure-commitsSkill
- test-tag-pipelineSkill
- triage-leaked-infraSkill
- update-konflux-tasksSkill
- validate-pr-override-imagesSkill
- Git Commit FormatSkill
- restructure-commitsSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 3 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 41
If --non-expiring is present in the arguments, produce a permanent image.
- Distinctive: line 47
Before doing anything else, verify the user is logged in to the correct cluster and project:
- Very specific: line 49
Run oc whoami --show-server and confirm it returns https://api.stone-prd-rh01.pg1f.p1.openshiftapps.com:6443.
- Very specific: line 53
Run oc project -q and confirm it returns crt-redhat-acm-tenant.
- Distinctive: line 57
If the switch fails, stop and tell the user they don't have access to the required namespace.
- Distinctive: line 59
Only proceed to the next steps once both checks pass.
- Very specific: line 63
Use gh pr view <PR> --json headRefOid,headRefName,baseRefName,url to get:
- Very specific: line 70
If the user provided a specific pipeline file path (e.g., .tekton/hypershift-release-mce-26-push.yaml), use that template directly via git …
- Very specific: line 81
Remove all pipelinesascode.tekton.dev/* annotations (these are PaC trigger annotations, not needed for manual runs)
- Very specific: line 87
If --non-expiring was specified: remove image-expires-after param entirely
- Very specific: line 90
If pipelineRef uses a resolver: git, keep it as-is.
- Very specific: line 91
Write the YAML to /tmp/<component>-manual-push.yaml
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create a manual Konflux build from a PR
Given a PR and a component name, create a manual PipelineRun that produces a container image. By default the image expires after 30 days. Use --non-expiring to produce a permanent image.
Usage Examples
- Build a specific component from a PR number (expires in 30 days):
/konflux-build 7813 hypershift-release-mce-26 - Build from a PR URL (will prompt for component):
/konflux-build https://github.com/openshift/hypershift/pull/7813 - Build a non-expiring image for a hotfix:
/konflux-build 7813 hypershift-operator --non-expiring - Build using a specific pipeline template:
/konflux-build 7813 .tekton/hypershift-release-mce-26-push.yaml - Build the main operator from a PR:
/konflux-build 7500 hypershift-operator
What This Command Does
- Verifies you are logged into the Konflux cluster (
stone-prd-rh01) - Resolves the PR to get its head commit SHA and base branch
- Finds the matching push pipeline template from
.tekton/on the base branch - Generates a manual PipelineRun YAML with template variables resolved
- Sets image expiry to 30 days (or removes it if
--non-expiringis specified) - Creates the PipelineRun and polls until completion
- Reports the final image reference with
@sha256:digest
Input
- PR: $ARGUMENTS (GitHub PR URL or number for openshift/hypershift)
- Component or pipeline file: either a component name (e.g.,
hypershift-operator) or a path to a specific pipeline template (e.g.,.tekton/hypershift-release-mce-26-push.yaml). If not specified, ask the user which component to build. - If
--non-expiringis present in the arguments, produce a permanent image; otherwise setimage-expires-after: 30d
Steps
0. Pre-check: verify OpenShift login
Before doing anything else, verify the user is logged in to the correct cluster and project:
- Run
oc whoami --show-serverand confirm it returnshttps://api.stone-prd-rh01.pg1f.p1.openshiftapps.com:6443. If not, stop and tell the user to log in:oc login https://api.stone-prd-rh01.pg1f.p1.openshiftapps.com:6443 - Run
oc project -qand confirm it returnscrt-redhat-acm-tenant. If not, switch to it:
If the switch fails, stop and tell the user they don't have access to the required namespace.oc project crt-redhat-acm-tenant
Only proceed to the next steps once both checks pass.
1. Resolve the PR
Use gh pr view <PR> --json headRefOid,headRefName,baseRefName,url to get:
- The commit SHA (
headRefOid) - The base branch (
baseRefName) — this determines which push template to use - The PR URL for reference
2. Find the push pipeline template
If the user provided a specific pipeline file path (e.g., .tekton/hypershift-release-mce-26-push.yaml), use that template directly via git show <baseRef>:<pipeline-file>.
Otherwise, look in the .tekton/ directory of the PR's base branch for *-push.yaml files. Match by component name if provided, or list the available components and let the user pick.
The template lives on the base branch of the PR. Use git show <baseRef>:.tekton/ to list available templates, then git show <baseRef>:.tekton/<template-file> to read the chosen one.
3. Generate the PipelineRun YAML
Take the push pipeline template and resolve it into a concrete PipelineRun:
- Replace
namewithgenerateNamebased on the template'snamefield, replacing-on-pushwith-manual-push- - Remove all
pipelinesascode.tekton.dev/*annotations (these are PaC trigger annotations, not needed for manual runs) - Replace
{{revision}}and{{source_url}}with actual values:{{revision}}→ the PR's head commit SHA{{source_url}}→https://github.com/openshift/hypershift.git{{target_branch}}→ the PR's base branch
- Image expiry handling:
- If
--non-expiringwas specified: removeimage-expires-afterparam entirely - Otherwise: ensure an
image-expires-afterparam is present with value30d(add it if the template doesn't have one, or update it if it does)
- If
- Replace the git-auth workspace secret reference (
{{ git_auth_secret }}) withgit-auth-empty - If
pipelineRefuses aresolver: git, keep it as-is. If it usesname:, keep it as-is. - Write the YAML to
/tmp/<component>-manual-push.yaml
4. Ensure the git-auth-empty secret exists
The git-clone Tekton task requires the git-auth workspace to be a kubernetes.io/basic-auth typed secret. Since openshift/hypershift is a public repo, we use an empty secret instead of real credentials (which would be visible to all tenant users):
oc get secret git-auth-empty -n crt-redhat-acm-tenant 2>/dev/null || \
oc create secret generic git-auth-empty \
--type=kubernetes.io/basic-auth \
--from-literal=username='' \
--from-literal=password='' \
-n crt-redhat-acm-tenant5. Show the user the PipelineRun YAML and confirm
Display the generated YAML and ask for confirmation before applying. Clearly indicate whether the image will expire (and when) or be permanent.
6. Apply the PipelineRun
oc create -f /tmp/<component>-manual-push.yamlReport the PipelineRun name.
7. Wait for the image and report the digest
Poll oc get pipelinerun <name> every 30 seconds until it completes or disappears (archived).
Once done (or if the PipelineRun gets archived before we can check), use skopeo to get the image digest:
skopeo inspect --no-tags docker://<output-image-url>Report the final image reference in @sha256: digest form, e.g.:
quay.io/redhat-user-workloads/crt-redhat-acm-tenant/<component>@sha256:<digest>Also show per-architecture digests from the manifest list if it's a multi-arch build.
Remind the user whether the image expires (and when) or is permanent.
Error Handling
| Scenario | Action |
| Not logged in to OpenShift | Show oc login command and stop |
| Wrong namespace / no access | Show error and stop |
| PR not found | Show error with PR number |
| No matching push template | List available templates and ask user to pick |
| Multiple component matches | List matches and ask user to pick |
| PipelineRun creation fails | Show error details |
| PipelineRun archived before completion | Fall back to skopeo inspect to check the image directly |
Requirements
ocCLI logged into the Konflux clusterghCLI authenticated with access to openshift/hypershiftskopeofor image inspection- Access to the
crt-redhat-acm-tenantnamespace
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

