Skip to content

feat(manualapprovalgate): integrate MAG as TektonConfig child component#3762

Open
pratap0007 wants to merge 1 commit into
tektoncd:mainfrom
pratap0007:add-mag-in-tektonconfig
Open

feat(manualapprovalgate): integrate MAG as TektonConfig child component#3762
pratap0007 wants to merge 1 commit into
tektoncd:mainfrom
pratap0007:add-mag-in-tektonconfig

Conversation

@pratap0007

@pratap0007 pratap0007 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Add ManualApproval field to TektonConfig spec so that TektonConfig manages the ManualApprovalGate CR lifecycle including ownerRef and platform-data-hash propagation for TLS profile changes.

  • Disabled by default on fresh installs
  • On upgrade, standalone MAG CRs (no ownerRef) are adopted under TektonConfig instead of being deleted
  • Add validation for spec.manualApproval.options
  • Add unit tests for create, delete, ownerRef migration, and platform-data-hash annotation sync

Fixes #3656

Assisted-by: Claude Opus 4.6 (via Claude Code)

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

Add ManualApproval component to the TektonConfig to manage the ManualApprovalGate CR lifecycle.

Add ManualApproval field to TektonConfig spec so that TektonConfig
manages the ManualApprovalGate CR lifecycle including ownerRef and
platform-data-hash propagation for TLS profile changes.

- Disabled by default on fresh installs
- On upgrade, standalone MAG CRs (no ownerRef) are adopted
  under TektonConfig instead of being deleted
- Add validation for spec.manualApproval.options
- Add unit tests for create, delete, ownerRef migration,
  and platform-data-hash annotation sync

Fixes tektoncd#3656

Signed-off-by: Shiv Verma <shverma@redhat.com>
Assisted-by: Claude Opus 4.6 (via Claude Code)
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jul 20, 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 ask for approval from pratap0007 after the PR has been reviewed.

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 Jul 20, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 25.67%. Comparing base (75853c3) to head (093140c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3762      +/-   ##
==========================================
+ Coverage   25.49%   25.67%   +0.17%     
==========================================
  Files         449      450       +1     
  Lines       23370    23491     +121     
==========================================
+ Hits         5959     6031      +72     
- Misses      16725    16767      +42     
- Partials      686      693       +7     
Flag Coverage Δ
unit-tests 25.67% <ø> (+0.17%) ⬆️

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Integrates the ManualApprovalGate (MAG) component into the TektonConfig reconciliation flow so TektonConfig can create/adopt/delete the MAG CR and propagate platform-data-hash changes, aligning MAG with how other Tekton components are managed.

Changes:

  • Add spec.manualApproval to TektonConfigSpec with defaulting + validation wiring.
  • Introduce shared manualapprovalgate helper package to ensure/create/update/delete the MAG CR (including ownerRef and platform-data-hash propagation).
  • Add unit tests covering MAG create/delete, ownerRef migration, and platform-data-hash propagation.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/reconciler/shared/tektonconfig/tektonconfig.go Wire MAG lifecycle into TektonConfig reconcile/finalize and propagate platform-data-hash.
pkg/reconciler/shared/tektonconfig/manualapprovalgate/manualapprovalgate.go New shared helper functions to ensure/update/delete MAG CR.
pkg/reconciler/shared/tektonconfig/manualapprovalgate/manualapprovalgate_test.go Unit tests for MAG helper behaviors (create/delete/migration/platform hash).
pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go Generated deepcopy updates for new ManualApproval.Disabled pointer + TektonConfigSpec field.
pkg/apis/operator/v1alpha1/tektonconfig_validation.go Add validation for spec.manualApproval.options.
pkg/apis/operator/v1alpha1/tektonconfig_types.go Add ManualApproval field to TektonConfig spec.
pkg/apis/operator/v1alpha1/tektonconfig_defaults.go Default ManualApproval to disabled on fresh installs.
pkg/apis/operator/v1alpha1/manualapprovalgate_types.go Add ManualApproval.Disabled + helpers (setDefaults, IsDisabled).
Files not reviewed (1)
  • pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +331 to +338
magEnabled := !tc.Spec.ManualApproval.IsDisabled()
if !magEnabled {
existingMAG, err := manualapprovalgate.GetManualApprovalGate(ctx, r.operatorClientSet.OperatorV1alpha1().ManualApprovalGates(), v1alpha1.ManualApprovalGates)
if err == nil && len(existingMAG.OwnerReferences) == 0 {
logger.Debug("Found standalone ManualApprovalGate CR from previous version, adopting under TektonConfig")
magEnabled = true
}
}
Comment on lines +102 to +105
if old.ObjectMeta.OwnerReferences == nil {
old.ObjectMeta.OwnerReferences = new.ObjectMeta.OwnerReferences
updated = true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

feat: integrate ManualApprovalGate as a TektonConfig child component

4 participants