Skip to content

WIP(openshift builds extension): add Shipwright Build and Shared Res… - #4130

Draft
sayan-biswas wants to merge 1 commit into
tektoncd:mainfrom
sayan-biswas:builds-extension
Draft

sayan-biswas wants to merge 1 commit into
tektoncd:mainfrom
sayan-biswas:builds-extension

Conversation

@sayan-biswas

Copy link
Copy Markdown

Changes

Replace the OpenShiftBuild component with two dedicated components: ShipwrightBuild, reconciled on both Kubernetes and OpenShift, and SharedResource. Add their API types, defaults, validation, lifecycle helpers, reconcilers, generated clients, and CRDs, and wire them into TektonConfig and the platform component lists.

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

NONE

…ource

Replace the OpenShiftBuild component with two dedicated components:
ShipwrightBuild, reconciled on both Kubernetes and OpenShift, and
SharedResource. Add their API types, defaults, validation, lifecycle
helpers, reconcilers, generated clients, and CRDs, and wire them into
TektonConfig and the platform component lists.

Signed-off-by: Sayan Biswas <[email protected]>
@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Sep 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 pramodbindal after the PR has been reviewed.
You can assign the PR to them by writing /assign @pramodbindal 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 21, 2026
@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 26.01%. Comparing base (7dfc9db) to head (7191617).
⚠️ Report is 41 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4130      +/-   ##
==========================================
- Coverage   27.64%   26.01%   -1.64%     
==========================================
  Files         477      520      +43     
  Lines       25458    27114    +1656     
==========================================
+ Hits         7039     7054      +15     
- Misses      17696    19336    +1640     
- Partials      723      724       +1     
Flag Coverage Δ
unit-tests 26.01% <ø> (-1.64%) ⬇️

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.


func IsEnabled(config *v1alpha1.TektonConfig) bool {
if v1alpha1.IsOpenShiftPlatform() {
return *config.Spec.Platforms.OpenShift.ShipwrightBuild.Enabled

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

check for nil dereference if config.Spec.Platforms.OpenShift.ShipwrightBuild is nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Line 44, the Kubernetes side, has the same problem, and it crashes the operator on a default Kubernetes install.

I deployed this branch to kind with ko and the default Kubernetes overlay. The TektonConfig the operator creates for itself has no shipwrightBuild block. The tekton-operator-lifecycle container restarted twice in 10 minutes with panic: runtime error: invalid memory address or nil pointer dereference at shipwrightbuild.go:44, called from PostReconcile at extension.go:76.

After I set shipwrightBuild.enabled: true, it did not restart again in the next 7 minutes.

Comment thread hack/fetch-releases.sh
case $version in
latest)
dirVersion=$(curl -sL https://api.github.com/repos/$github_component/releases | jq -r ".[].tag_name" | sort -Vr | head -n1)
dirVersion=$(curl -sL https://api.github.com/repositorys/$github_component/releases | jq -r ".[].tag_name" | sort -Vr | head -n1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why this change ? it will break gh api call

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Same, not intended. Shipwright will need a separate pull mechanism, because there are different file names and more files to pull. Will clean up in final PR.

Comment thread Makefile
##@ Apply
.PHONY: apply
apply: | $(KO) $(KUSTOMIZE) get-releases ; $(info $(M) ko apply on $(TARGET)) @ ## Apply config to the current cluster
apply: #| $(KO) $(KUSTOMIZE) get-releases ; $(info $(M) ko apply on $(TARGET)) @ ## Apply config to the current cluster

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

#? this is breakin apply command

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is not intended. Commented for local testing. Will clean up in the final PR.

return func(ctx context.Context, manifest *manifestival.Manifest, component v1alpha1.TektonComponent) (*manifestival.Manifest, error) {
sr := component.(*v1alpha1.SharedResource)
*manifest = manifest.Filter(manifestival.Not(manifestival.ByKind("Namespace")))
images := common.ToLowerCaseKeys(common.ImagesFromEnv(common.ShipwrightBuildImagePrefix))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

common.ShipwrightBuildImagePrefix ?? isnt it sharedresource here

Comment thread components.yaml
multicluster-proxy-aae:
github: openshift-pipelines/multicluster-proxy-aae
version: v0.1.1
shipwright-build:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

missing sharedresource component entry ?

)

// FilterAndTransform installs the Builds manifests into the openshift-builds
// namespace. The upstream operator applies the same InjectNamespace transform;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove openshift-builds namespace, lets have evrything in openshfit-pipelines namespace if possible


// Package sharedresource installs the Shared Resource component whose desired
// state is expressed through the SharedResource CRD. It is an OpenShift-only
// component sourced from the upstream openshift-builds operator.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

probably not mention legacy openshift-builds operator

// targetNamespace is the namespace where the OpenShift Builds components are
// installed. It matches the namespace used by the upstream openshift-builds
// operator.
//const targetNamespace = "openshift-builds"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove this


func (sr *SharedResource) SetDefaults(ctx context.Context) {
// Both components default to Enabled when their block is present but the
// state is unset, mirroring the upstream openshift-builds operator.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here, we need to remove reference to upstream builds operator


// Ensure Shipwright Build CR
if shipwrightbuild.IsEnabled(configInstance) {
if _, err := shipwrightbuild.CreateOrUpdate(ctx, ke.operatorClientSet.OperatorV1alpha1().ShipwrightBuilds(), configInstance, configInstance.Status.Version); err != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please ensure here that function doesnt create tektonconfig (thinking about some code in builds) , the ownership should look like this: TektonConfig (parent) → ShipwrightBuild / SharedResource CRs → InstallerSets → operand

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Right. But I believe that part in the Shipwright Operator, which we have bypassed here and directly deploying controller. I'll check and confirm. this.

ControllerTektonResults: injection.NamedControllerConstructor{
Name: string(ControllerTektonResults),
ControllerConstructor: k8sResult.NewController},
platform.ControllerShipwrightBuild: injection.NamedControllerConstructor{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Neither operator Deployment starts this controller. The -controllers lists in config/kubernetes/base/operator.yaml and config/openshift/base/operator.yaml have no shipwrightbuild or sharedresource.

I deployed this branch to kind with ko and set shipwrightBuild.enabled: true with profile all. The operator created the ShipwrightBuild CR, but nothing reconciled it. Its status stayed empty, and TektonConfig stayed Ready=False with ShipwrightBuild: reconcile again and proceed for 8 minutes.

When I added shipwrightbuild to the Kubernetes list, the controller picked up the CR and installed Shipwright. Could we add it to both lists, and sharedresource to the OpenShift one?

}

// Create Post InstallerSet of installing Build Strategies
if err := r.installerSetClient.PostSet(ctx, sb, r.strategyManifest, NilFilterAndTransform(r)); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The operator's service account can't install the ClusterBuildStrategies this post set applies, because no role under config/ grants shipwright.io.

On kind, with this branch deployed with ko and shipwrightbuild added to -controllers, the post InstallerSet failed with clusterbuildstrategies.shipwright.io "buildah-shipwright-managed-push" is forbidden: User "system:serviceaccount:tekton-operator:tekton-operator" cannot get resource "clusterbuildstrategies". TektonConfig stayed not ready.

After I bound a ClusterRole for shipwright.io to that account, the ShipwrightBuild CR and TektonConfig were both Ready within 3 minutes. Could the operator's ClusterRole get these rules?

WebhookSecretName = "shipwright-build-webhook-cert"
WebhookServiceName = "shp-build-webhook"
WebhookSecretDuration = 365 * 24 * time.Hour
WebhookVersionFlag = "-version"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Shipwright webhook reads its flags with pflag, which treats a single dash as a short flag. So -version is read as -v and the pod exits with unknown shorthand flag: 'v' in -version.

On a kind cluster, the operator from this branch left shipwright-build-webhook in CrashLoopBackOff. With --version the pod runs. The OpenShift -tls-min-version and -tls-cipher-suites flags fail the same way (unknown shorthand flag: 't').

Could these use --?

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesnt merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants