Repository navigation
feat: tag E2E job infrastructure resource groups with jobID - #7436
Ghazi Alchammat (galchammat) wants to merge 1 commit into
Conversation
|
Pipeline controller notification This PR uses the pipeline controller for second-stage tests. Selection and triggering follow the repository configuration. Use |
|
Skipping CI for Draft Pull Request. |
There was a problem hiding this comment.
🟡 Changes recommended
Job-ID validation and case-insensitive tag protection have correctness gaps, and the new resource-group safety branches lack direct coverage.
3 open findings
What changed in this PR
Adds Prow job-ID tags to E2E-owned Azure resource groups for cross-subscription cost attribution.
Changes:
- Adds creation-only resource-group tags to templatize.
- Tags per-run AKS infrastructure from CI scripts.
- Tags RP-managed HCP resource groups during creation and cleanup.
| File | Description |
|---|---|
tooling/templatize/pkg/pipeline/run.go |
Adds resource-group creation tags to run options. |
tooling/templatize/pkg/pipeline/arm.go |
Applies tags only during resource-group creation. |
tooling/templatize/pkg/pipeline/arm_test.go |
Tests creation-tag composition. |
tooling/templatize/pkg/pipeline/arm_stack.go |
Passes tags to ARM stack resource groups. |
tooling/templatize/cmd/entrypoint/run/options.go |
Adds and validates the tagging CLI flag. |
tooling/templatize/cmd/entrypoint/run/options_test.go |
Tests tag validation. |
test/util/framework/per_test_framework.go |
Discovers and tags managed resource groups. |
test/util/framework/managed_resource_group_tags.go |
Implements managed-group job tagging. |
test/util/framework/managed_resource_group_tags_test.go |
Tests tagging helpers and ownership matching. |
test/util/framework/helpers_v20261001preview.go |
Tags managed groups after cluster creation. |
test/util/framework/helpers_v20260901preview.go |
Tags managed groups after cluster creation. |
test/util/framework/helpers_v20260630preview.go |
Tags managed groups after cluster creation. |
test/util/framework/helpers_v20251223preview.go |
Tags managed groups after cluster creation. |
test/util/framework/helpers_v20240610preview.go |
Tags managed groups after cluster creation. |
test/util/framework/deployment_helper.go |
Tags groups created by HCP Bicep deployments. |
hack/ci/provision-environment.sh |
Passes job tags to templatize. |
hack/ci/build-config-override.sh |
Adds job tags to per-run AKS configuration. |
docs/ci/execution.md |
Documents cost-attribution behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
b8c63e0 to
3cafdf9
Compare
3cafdf9 to
8abe184
Compare
8abe184 to
f4e11f4
Compare
|
/test all |
|
Scheduling tests matching the |
|
Ghazi Alchammat (@galchammat) I would drop the HCP managed resource group tagging from this PR and merge the rest, given that managed group spend is a tiny fraction of the cost compared with AKS spend. Instead, what we could do is implement tag propagation directly in the RP, same way AKS does. This would also benefit our customers, who would be able to apply tags and have them propagated to their HCP managed resource groups. I would check with the 1p/CS teams about the feasibility of implementing this. What to drop from the PR:
There's another issue with the PR as it is: it conflicts with #7502, which moves the |
|
/hold Changes requested. Also conflicts with #7502. |
|
roi (@roivaz) Dropped the managed resource group tagging and its supporting code. The port onto #7502's Go generator is ready (diff on top of #7502); I'll swap it into this PR once #7502 merges. |
|
Scheduling tests matching the |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: galchammat The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
#7502 is now merged |
169d7b8 to
85e60ba
Compare
|
/test integration |
|
Scheduling tests matching the |
a4c25f2 to
8759c9f
Compare
|
Scheduling tests matching the |
|
/retest unrelated failure |
|
/retest |
| func newResourceGroupTags(creationTags map[string]string, persist bool) map[string]*string { | ||
| tags := make(map[string]*string, len(creationTags)) | ||
| for key, value := range creationTags { | ||
| tags[key] = to.Ptr(value) | ||
| } | ||
| return computeResourceGroupTags(tags, persist) | ||
| } |
There was a problem hiding this comment.
Don't wrap the function. Extend computeResourceGroupTags to adapt it to the new behavior instead. Also, any particular reason we don't want these cost tags reconciled instead of just applied during resource group creation?
| flags.StringVar(&opts.MSIMockCatalog, "msi-mock-pool-catalog", opts.MSIMockCatalog, "MSI mock catalog (default source-dir/dev-infrastructure/openshift-ci/msi-mock-pool.yaml)") | ||
| flags.StringVar(&opts.ARMHelperCatalog, "arm-helper-pool-catalog", opts.ARMHelperCatalog, "ARM helper catalog (default source-dir/dev-infrastructure/openshift-ci/arm-helper-pool.yaml)") | ||
| flags.StringVar(&opts.HypershiftOverlay, "hypershift-override-file", opts.HypershiftOverlay, "Hypershift overlay (default shared-dir/hypershift-image-overrides.yaml)") | ||
| flags.StringVar(&opts.TemplatizeSettings, "templatize-settings", opts.TemplatizeSettings, "Templatize settings deciding per-run environments (default source-dir/tooling/templatize/settings.yaml)") |
There was a problem hiding this comment.
Walking the whole config file to find just the AKS tags that are set looks way too complex. All other overrides blindly overwrite the config key value, let's just do the same with the AKS tags - check what tags are being set today for ci00/ci01 envs and just overwrite the whole config key with those and the new cost tag.
| flags.StringVar(&opts.ARMHelperCatalog, "arm-helper-pool-catalog", opts.ARMHelperCatalog, "ARM helper catalog (default source-dir/dev-infrastructure/openshift-ci/arm-helper-pool.yaml)") | ||
| flags.StringVar(&opts.HypershiftOverlay, "hypershift-override-file", opts.HypershiftOverlay, "Hypershift overlay (default shared-dir/hypershift-image-overrides.yaml)") | ||
| flags.StringVar(&opts.TemplatizeSettings, "templatize-settings", opts.TemplatizeSettings, "Templatize settings deciding per-run environments (default source-dir/tooling/templatize/settings.yaml)") | ||
| flags.StringVar(&opts.ServiceConfig, "service-config", opts.ServiceConfig, "Service config providing effective AKS tags (default source-dir/config/config.yaml)") |
There was a problem hiding this comment.
All other overrides are opt-in via environment variables in the openshift/release configuration - do the same here. Include a RUN_COST_TAG_VALUE env variable in the job configuration and use it, then you don't need to discover it by parsing the settings.yaml file. Keep it simple.
| flags.StringVar(&opts.HypershiftOverlay, "hypershift-override-file", opts.HypershiftOverlay, "Hypershift overlay (default shared-dir/hypershift-image-overrides.yaml)") | ||
| flags.StringVar(&opts.TemplatizeSettings, "templatize-settings", opts.TemplatizeSettings, "Templatize settings deciding per-run environments (default source-dir/tooling/templatize/settings.yaml)") | ||
| flags.StringVar(&opts.ServiceConfig, "service-config", opts.ServiceConfig, "Service config providing effective AKS tags (default source-dir/config/config.yaml)") | ||
| flags.StringVar(&opts.RunCostTagFile, "run-cost-tag-file", opts.RunCostTagFile, "File receiving the run cost tag for the provisioning shell (default shared-dir/run-cost-tag.env)") |
There was a problem hiding this comment.
If the step has an opt-in RUN_COST_TAG_VALUE env variable you won't need this either.
Attribute each DEV E2E Prow job's infrastructure spend by tagging the resource groups it creates with jobID.aro-hcp-ci.redhat.com=<BUILD_ID>. Cost Management tag inheritance on the E2E subscriptions applies the tag to usage records of everything inside them. - jobs opt in by setting RUN_COST_TAG_VALUE; the literal BUILD_ID resolves to this job's Prow build ID, because ci-operator configuration cannot expand $(BUILD_ID) itself - the config override generator adds the tag to the service and management AKS cluster tags, replacing the whole tags key with the values ci00/ci01 otherwise inherit from config/config.yaml; AKS copies them onto each node resource group - templatize's --resource-group-tags set the tags on resource groups a run creates; on an existing group they only replace tag keys the group already carries, so shared groups never gain a run-scoped tag - build-config-override and provision-environment.sh both resolve RUN_COST_TAG_VALUE from the same environment, so no tag handoff file is needed - the offline command test clears RUN_COST_TAG_VALUE and BUILD_ID, which Prow sets, with the other CI inputs it isolates (AROSLSRE-2394) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8759c9f to
3071de3
Compare
|
Scheduling tests matching the |
|
Ghazi Alchammat (@galchammat): The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |

AROSLSRE-2394
What
Tags the infrastructure resource groups a DEV E2E Prow job creates with
jobID.aro-hcp-ci.redhat.com=<BUILD_ID>, the same key the e2e framework already sets on test resource groups. A job opts in by settingRUN_COST_TAG_VALUEin its openshift/release configuration; the literalBUILD_IDresolves to this job's Prow build ID, because ci-operator configuration cannot expand$(BUILD_ID)itself:build-config-overrideGo generator, invoked byhack/ci/build-config-override.sh, setssvc.aks.tags/mgmt.aks.tagsto the values ci00/ci01 otherwise inherit fromconfig/config.yamlplus the run cost tag; AKS copies cluster tags onto node resource groupshack/ci/provision-environment.shresolves the sameRUN_COST_TAG_VALUEand passes templatize's--resource-group-tags, set in full on resource groups the run createsBoth consumers read
RUN_COST_TAG_VALUEfrom the environment they already share, so no tag handoff file is needed.Why
Cost Management tag inheritance is enabled on the five E2E subscriptions (AROSLSRE-2276), so a resource group's tags reach the usage records of everything inside it. In a sampled run, AKS node resource groups were about 84% of the cost and templatize-created groups 5%; neither carried a run identifier. With them tagged, one Cost Management filter shows most of a job's spend across subscriptions.
Behavior and safety
RUN_COST_TAG_VALUE— including long-lived environments such ascsprthat source the same override script — are never tagged, so shared clusters never carry the ID of whichever job deployed them last.[A-Za-z0-9._-], including whitespace, is rejected;RUN_COST_TAG_VALUE=BUILD_IDwithoutBUILD_IDset is an error in both the generator and the provisioning shell.--resource-group-tagsin full only on resource groups the run creates. On an existing group each extra tag only replaces a key the group already carries, in any key casing; a group never gains a tag it did not have.ensureResourceGroupExistscreates a group only on 404 and returns otherGeterrors, so a transient failure can no longer re-create, and re-tag, an existing group.CI configuration change: this modifies the CI-invoked scripts
hack/ci/build-config-override.shandhack/ci/provision-environment.sh. A companion openshift/release PR (openshift/release#87928) declaresRUN_COST_TAG_VALUEin the provision environment step and enables it for the dev e2e-parallel jobs.Testing
options_test.go); extra tags with persist rules on created and existing groups (arm_test.go);ensureResourceGroupExistsagainst a fake ARM server, covering 404 create, existing-group preservation, re-stamping a carried key, untagged groups gaining nothing, and no writes on 401/403/429/500 (arm_resourcegroup_test.go).override_test.go,cmd_test.go): sentinel resolution, explicit values, no opt-in, and rejection of invalid values; the sourcedbuild-config-override.shadapter end-to-end, including that no handoff file is published.ci01configuration through templatize with the generated override: bothsvc.aks.tagsandmgmt.aks.tagscontain the job ID.aks-cluster-createand the BicepcsvTagsToObjectparsers accept the dotted key.go build,go vet,go test -raceandgolangci-linton the changed packages.To verify a run, query Resource Graph for resource groups with tag
jobID.aro-hcp-ci.redhat.comequal to the job's build ID in the E2E infrastructure subscription. Usage records pick up inherited tags within about 24 hours.Non-goals
PR Checklist