fix(tektonconfig): make platform subtrees pointers - #3962
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3962 +/- ##
==========================================
+ Coverage 26.33% 26.36% +0.02%
==========================================
Files 465 465
Lines 24951 24973 +22
==========================================
+ Hits 6572 6583 +11
- Misses 17661 17671 +10
- Partials 718 719 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
f64e21d to
4d74f04
Compare
4d74f04 to
8927034
Compare
Convert spec.platforms.openshift and spec.platforms.kubernetes to pointer types so the stored TektonConfig only persists the subtree for the running platform. The PipelinesAsCode artifact pre-upgrade now runs on Kubernetes as well as OpenShift, cleaning hub-catalog-name from whichever platform's PaC spec is set. Signed-off-by: Anchita Borah <anborah@redhat.com>
8927034 to
dda4074
Compare
|
@anchi205 On kind with local registry For OpenShift: make TARGET=openshift applyKO_DOCKER_REPO=ttl.sh make TARGET=openshift apply |
|
1st Bug exists on Kind with main branch: AFTER FIXING kubectl get tektonconfig config -o jsonpath='{.spec.platforms}' | jq 'keys'Result: ["openshift"]kubectl get tektonconfig config -o json | jq '.spec.platforms | has("kubernetes")'
# Output: falseKind Fresh Install kubectl get tektonconfig config -o jsonpath='{.spec.platforms}' | jq 'keys'Result: ["kubernetes"]kubectl get tektonconfig config -o json | jq '.spec.platforms | has("openshift")'
# Output: falseUpgrade test go test -v ./pkg/reconciler/shared/tektonconfig/upgrade -run TestPreUpgradePipelinesAsCodeArtifactsResult: Change #2: Kubernetes PreUpgrade Logic - Verified Test: Kubernetes Platform Upgrade go test -v ./pkg/reconciler/shared/tektonconfig/upgrade -run TestPreUpgradePipelinesAsCodeArtifacts_NonOpenShiftResult: Code verification: grep -A 10 "Get PaC spec for the current platform" pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade.goShows: // Get PaC spec for the current platform
var pacSpec *v1alpha1.PipelinesAsCode
if v1alpha1.IsOpenShiftPlatform() {
if tc.Spec.Platforms.OpenShift != nil {
pacSpec = tc.Spec.Platforms.OpenShift.PipelinesAsCode
}
} else {
if tc.Spec.Platforms.Kubernetes != nil {
pacSpec = tc.Spec.Platforms.Kubernetes.PipelinesAsCode // ← Both platforms handled
}
}Change #3: Release Files - Verified Test: Release File Loading go test -v ./pkg/reconciler/common -run TestListReleasesResult: File verification: # Check dummy files removed
ls pkg/reconciler/common/testdata/kodata/pipelines-as-code/*/dummy.yaml 2>&1
# Output: no matches found: pkg/reconciler/common/testdata/kodata/pipelines-as-code/*/dummy.yaml
# Check release.yaml files exist with content
ls -lh pkg/reconciler/common/testdata/kodata/pipelines-as-code/*/release.yaml
# Output:
# -rw-r--r-- pkg/reconciler/common/testdata/kodata/pipelines-as-code/0.1.0/release.yaml
# -rw-r--r-- pkg/reconciler/common/testdata/kodata/pipelines-as-code/0.2.0/release.yaml
wc -l pkg/reconciler/common/testdata/kodata/pipelines-as-code/*/release.yaml
# Output:
# 86 pkg/reconciler/common/testdata/kodata/pipelines-as-code/0.1.0/release.yaml
# 86 pkg/reconciler/common/testdata/kodata/pipelines-as-code/0.2.0/release.yaml
# 172 total |
Changes
Convert spec.platforms.openshift and spec.platforms.kubernetes to pointer types so the stored TektonConfig only persists the subtree for the running platform.
The PipelinesAsCode artifact pre-upgrade now runs on Kubernetes as well as OpenShift, cleaning hub-catalog-name from whichever platform's PaC spec is set.
Submitter Checklist
make test lintbefore submitting a PRRelease Notes