Skip to content

Commit 8f8d704

Browse files
committed
feat: Add PipelineRun support to BuildRun reconciler
This commit introduces PipelineRun support to the BuildRun reconciler, enabling Shipwright to use Tekton PipelineRuns as an alternative to TaskRuns for build execution. Key changes: - Add pipelinerun_runner.go with TektonPipelineRunWrapper implementation that wraps Tekton PipelineRuns and injects TaskRun specs into PipelineRun structures. - Implement ImageBuildRunner and ImageBuildRunnerFactory interfaces for PipelineRun support. - Add reconciliation logic for PipelineRun status updates, including condition handling and failure detection - Add UpdateBuildRunUsingPipelineRunCondition function to update BuildRun status based on PipelineRun conditions (timeout, cancellation, success, failure) - Refactor volume checking to use GetUnderlyingTaskRun() method for both TaskRun and PipelineRun executors, eliminating the need for separate volume checking methods - Add RunnerFactories map to support configurable executor selection between TaskRun and PipelineRun implementations - Update error handling in CreateImageBuildRunner - Add UpdateImageBuildRunFromExecutor to handle updating Buildrun based on used executor (pipelinerun or taskrun) The implementation maintains backward compatibility. Signed-off-by: Hasan Awad <hasan.m.awad94@gmail.com>
1 parent d158522 commit 8f8d704

File tree

89 files changed

+4468
-1002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+4468
-1002
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Login to container registry
2727
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login -u ${{ github.repository_owner }} --password-stdin ghcr.io
2828
- name: Install Go
29-
uses: actions/setup-go@v5
29+
uses: actions/setup-go@v6
3030
with:
3131
go-version: '1.24.x'
3232
cache: true
@@ -82,14 +82,14 @@ jobs:
8282
tekton: v0.65.7
8383
# newest supported Kubernetes and Tekton LTS that exists at the time of our planned next release
8484
- kubernetes: v1.33.1
85-
tekton: v1.3.1 # RETAIN-COMMENT: TEKTON_NEWEST_LTS
85+
tekton: v1.3.2 # RETAIN-COMMENT: TEKTON_NEWEST_LTS
8686
max-parallel: 4
8787
runs-on: ubuntu-latest
8888
steps:
8989
- name: Check out code
9090
uses: actions/checkout@v5
9191
- name: Install Go
92-
uses: actions/setup-go@v5
92+
uses: actions/setup-go@v6
9393
with:
9494
go-version: '1.24.x'
9595
cache: true
@@ -150,6 +150,9 @@ jobs:
150150
export IMAGE_PROCESSING_CONTAINER_IMAGE="$(KO_DOCKER_REPO=kind.local ko publish ./cmd/image-processing)"
151151
152152
make test-integration
153+
- name: Test-PipelineRun
154+
run: |
155+
BUILDRUN_EXECUTOR=PipelineRun ginkgo --focus-file="buildruns_to_pipelineruns_test.go" -v test/integration/...
153156
154157
e2e:
155158
strategy:
@@ -161,14 +164,14 @@ jobs:
161164
tekton: v0.65.7
162165
# newest supported Kubernetes and Tekton LTS that exists at the time of our planned next release
163166
- kubernetes: v1.33.1
164-
tekton: v1.3.1 # RETAIN-COMMENT: TEKTON_NEWEST_LTS
167+
tekton: v1.3.2 # RETAIN-COMMENT: TEKTON_NEWEST_LTS
165168
max-parallel: 4
166169
runs-on: oracle-vm-16cpu-64gb-x86-64
167170
steps:
168171
- name: Check out code
169172
uses: actions/checkout@v5
170173
- name: Install Go
171-
uses: actions/setup-go@v5
174+
uses: actions/setup-go@v6
172175
with:
173176
go-version: '1.24.x'
174177
cache: true
@@ -240,6 +243,33 @@ jobs:
240243
export TEST_E2E_FLAGS="-r --procs 8 --randomize-all --timeout=1h --trace --vv"
241244
export TEST_E2E_TIMEOUT_MULTIPLIER=2
242245
make test-e2e
246+
- name: Test-PipelineRun
247+
run: |
248+
export TEST_NAMESPACE=shp-e2e
249+
export TEST_IMAGE_REPO=registry.registry.svc.cluster.local:32222/shipwright-io/build-e2e
250+
export TEST_IMAGE_REPO_INSECURE=true
251+
export TEST_E2E_TIMEOUT_MULTIPLIER=1
252+
kubectl patch deployment shipwright-build-controller -n shipwright-build --type='json' -p='[
253+
{
254+
"op": "add",
255+
"path": "/spec/template/spec/containers/0/env/-",
256+
"value": {
257+
"name": "BUILDRUN_EXECUTOR",
258+
"value": "PipelineRun"
259+
}
260+
}
261+
]'
262+
# Wait for the rollout to complete
263+
kubectl rollout restart deployment shipwright-build-controller -n shipwright-build
264+
kubectl rollout status deployment shipwright-build-controller -n shipwright-build
265+
266+
# Run PipelineRun tests
267+
TEST_CONTROLLER_NAMESPACE=${TEST_NAMESPACE} \
268+
TEST_WATCH_NAMESPACE=${TEST_NAMESPACE} \
269+
TEST_E2E_SERVICEACCOUNT_NAME=pipeline \
270+
TEST_E2E_TIMEOUT_MULTIPLIER=${TEST_E2E_TIMEOUT_MULTIPLIER} \
271+
TEST_E2E_VERIFY_TEKTONOBJECTS=true \
272+
ginkgo --focus="PipelineRun E2E Tests" --procs 8 --timeout=1h --vv test/e2e/v1beta1/
243273
- name: Build controller logs
244274
if: ${{ failure() }}
245275
run: |

.github/workflows/nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@v5
23-
- uses: actions/setup-go@v5
23+
- uses: actions/setup-go@v6
2424
with:
2525
go-version: '1.24.x'
2626
cache: true

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
ref: ${{ inputs.git-ref }}
3737
fetch-depth: 0 # Fetch all history, needed for release note generation.
38-
- uses: actions/setup-go@v5
38+
- uses: actions/setup-go@v6
3939
with:
4040
go-version: '1.24.x'
4141
cache: true

.github/workflows/report-release-vulnerabilities.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
with:
2020
path: main
2121
- name: Install Go
22-
uses: actions/setup-go@v5
22+
uses: actions/setup-go@v6
2323
with:
2424
go-version: '1.24.x'
2525
cache: true
@@ -58,7 +58,7 @@ jobs:
5858
path: release-branch
5959
ref: ${{ steps.download-latest-release.outputs.release-branch }}
6060
- name: Install Go version of latest release
61-
uses: actions/setup-go@v5
61+
uses: actions/setup-go@v6
6262
with:
6363
go-version: "${{ steps.download-latest-release.outputs.go-version }}.x"
6464
cache: true

.github/workflows/update-tekton-version.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
token: ${{ secrets.SHIPWRIGHT_BUILD_WRITE_WORKFLOWS }}
2222
- name: Install Go
23-
uses: actions/setup-go@v5
23+
uses: actions/setup-go@v6
2424
with:
2525
go-version: '1.24.x'
2626
cache: true

.github/workflows/verify.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
path: go/src/github.com/shipwright-io/build
2727
- name: Install Go
28-
uses: actions/setup-go@v5
28+
uses: actions/setup-go@v6
2929
with:
3030
go-version: '1.24.x'
3131
cache: true

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ZAP_FLAGS ?= --zap-log-level=debug --zap-encoder=console
3636
TEST_NAMESPACE ?= default
3737

3838
# CI: tekton pipelines controller version
39-
TEKTON_VERSION ?= v1.3.1
39+
TEKTON_VERSION ?= v1.3.2
4040

4141
# E2E test flags
4242
TEST_E2E_FLAGS ?= -r -p --randomize-all --timeout=1h --trace --vv
@@ -213,6 +213,7 @@ test-integration: install-apis ginkgo
213213
--randomize-all \
214214
--randomize-suites \
215215
--fail-on-pending \
216+
--skip-file=buildruns_to_pipelineruns_test.go \
216217
-trace \
217218
test/integration/...
218219

@@ -226,7 +227,7 @@ test-e2e-plain: ginkgo
226227
TEST_E2E_SERVICEACCOUNT_NAME=${TEST_E2E_SERVICEACCOUNT_NAME} \
227228
TEST_E2E_TIMEOUT_MULTIPLIER=${TEST_E2E_TIMEOUT_MULTIPLIER} \
228229
TEST_E2E_VERIFY_TEKTONOBJECTS=${TEST_E2E_VERIFY_TEKTONOBJECTS} \
229-
$(GINKGO) ${TEST_E2E_FLAGS} test/e2e/
230+
$(GINKGO) --skip-file=e2e_pipelinerun_test.go ${TEST_E2E_FLAGS} test/e2e/
230231

231232
.PHONY: test-e2e-kind-with-prereq-install
232233
test-e2e-kind-with-prereq-install: ginkgo install-controller-kind install-strategies test-e2e-plain

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Shipwright supports any tool that can build container images in Kubernetes clust
3939
- We also require a Tekton installation (v0.59.+). To install the latest LTS release, run:
4040

4141
```bash
42-
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/previous/v1.3.1/release.yaml
42+
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/previous/v1.3.2/release.yaml
4343
```
4444

4545
If you are using OpenShift cluster refer [Running on OpenShift](#running-on-openshift) for some more configurations.

deploy/200-role.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ rules:
6767
# With the OwnerReferencesPermissionEnforcement admission controller enabled, controllers need the "delete" permission on objects that they set owner references on.
6868
verbs: ['get', 'list', 'watch', 'create', 'delete', 'patch']
6969

70+
- apiGroups: ['tekton.dev']
71+
resources: ['pipelineruns']
72+
verbs: ['get', 'list', 'watch', 'create', 'delete', 'patch']
73+
7074
- apiGroups: ['']
7175
resources: ['pods']
7276
verbs: ['get', 'list', 'watch']

docs/buildstrategies.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ spec:
440440
steps:
441441
...
442442
- name: build-and-push
443-
image: moby/buildkit:v0.23.2-rootless
443+
image: moby/buildkit:v0.24.0-rootless
444444
imagePullPolicy: Always
445445
workingDir: $(params.shp-source-root)
446446
...
@@ -939,7 +939,7 @@ If we apply the following resources:
939939

940940
```yaml
941941
- name: buildah-bud
942-
image: quay.io/containers/buildah:v1.40.1
942+
image: quay.io/containers/buildah:v1.41.4
943943
workingDir: $(params.shp-source-root)
944944
securityContext:
945945
privileged: true
@@ -961,7 +961,7 @@ If we apply the following resources:
961961
- name: buildah-images
962962
mountPath: /var/lib/containers/storage
963963
- name: buildah-push
964-
image: quay.io/containers/buildah:v1.40.1
964+
image: quay.io/containers/buildah:v1.41.4
965965
securityContext:
966966
privileged: true
967967
command:

0 commit comments

Comments
 (0)