Skip to content

fix(tektonconfig): make platform subtrees pointers - #3962

Open
anchi205 wants to merge 1 commit into
tektoncd:mainfrom
anchi205:fix/SRVKP-11787
Open

fix(tektonconfig): make platform subtrees pointers#3962
anchi205 wants to merge 1 commit into
tektoncd:mainfrom
anchi205:fix/SRVKP-11787

Conversation

@anchi205

Copy link
Copy Markdown
Contributor

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

Release Notes

NONE

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Aug 21, 2026
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign anithapriyanatarajan after the PR has been reviewed.
You can assign the PR to them by writing /assign @anithapriyanatarajan in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 26.36%. Comparing base (3901432) to head (dda4074).

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     
Flag Coverage Δ
unit-tests 26.36% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 21, 2026
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 21, 2026
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>
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 21, 2026
@jkhelil

jkhelil commented Aug 25, 2026

Copy link
Copy Markdown
Member

@anchi205
Can you please bring some verification proof that it is not impatcting frssh install and upgrades

# deploy from source
**For Kubernetes:**
```bash
cd operator
make apply

On kind with local registry

 KO_DOCKER_REPO=kind.local make apply

For OpenShift:

make TARGET=openshift apply

KO_DOCKER_REPO=ttl.sh make TARGET=openshift apply
or
KO_DOCKER_REPO=quay.io/jkhelil make TARGET=openshift apply



or operator upgrade
first apply to install from main
KO_DOCKER_REPO=[quay.io/jkhelil](http://quay.io/jkhelil) make TARGET=openshift apply
then checkout your changes 
and change version here
https://github.com/tektoncd/operator/blob/main/config/openshift/base/operator.yaml#L75
https://github.com/tektoncd/operator/blob/main/config/openshift/base/operator.yaml#L140
then apply again KO_DOCKER_REPO=[quay.io/jkhelil](http://quay.io/jkhelil) make TARGET=openshift apply

@anchi205

Copy link
Copy Markdown
Contributor Author

1st Bug exists on Kind with main branch:

  {
    "kubernetes": {...},
    "openshift": {}  // ← empty block
  }

AFTER FIXING
OpenShift Fresh install

kubectl get tektonconfig config -o jsonpath='{.spec.platforms}' | jq 'keys'

Result:

["openshift"]
kubectl get tektonconfig config -o json | jq '.spec.platforms | has("kubernetes")'
# Output: false

Kind 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: false

Upgrade test

go test -v ./pkg/reconciler/shared/tektonconfig/upgrade -run TestPreUpgradePipelinesAsCodeArtifacts

Result:

--- PASS: TestPreUpgradePipelinesAsCodeArtifacts (0.00s)
--- PASS: PAC_enabled_with_no_settings_-_should_update
--- PASS: PAC_enabled_with_tektonhub_settings_-_should_update
--- PASS: PAC_enabled_with_old_artifacthub_API_URL_-_should_update
--- PASS: PAC_enabled_with_correct_settings_-_should_not_update
--- PASS: PAC_enabled_with_hub-catalog-name_-_should_update_and_remove
--- PASS: PAC_enabled_with_tektonhub_and_hub-catalog-name_-_should_update_all
PASS

Change #2: Kubernetes PreUpgrade Logic - Verified

Test: Kubernetes Platform Upgrade

go test -v ./pkg/reconciler/shared/tektonconfig/upgrade -run TestPreUpgradePipelinesAsCodeArtifacts_NonOpenShift

Result:

=== RUN   TestPreUpgradePipelinesAsCodeArtifacts_NonOpenShift
--- PASS: TestPreUpgradePipelinesAsCodeArtifacts_NonOpenShift (0.00s)
PASS

Code verification:

grep -A 10 "Get PaC spec for the current platform" pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade.go

Shows:

// 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 TestListReleases

Result:

=== RUN   TestListReleases
--- PASS: TestListReleases (0.00s)
PASS

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Denotes a PR that doesnt merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants