Skip to content

Commit 162e2e5

Browse files
authored
Merge pull request #1614 from containers/konflux-tests
run tests during build pipelines
2 parents 3b11fcf + 8b1d2c0 commit 162e2e5

15 files changed

+237
-3
lines changed

.tekton/bats/bats-pull-request.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ spec:
3434
value: container-images/bats/Containerfile
3535
pipelineRef:
3636
name: pull-request-pipeline
37+
timeouts:
38+
pipeline: 6h
3739
workspaces:
3840
- name: git-auth
3941
secret:

.tekton/bats/bats-push.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ spec:
3131
value: container-images/bats/Containerfile
3232
pipelineRef:
3333
name: push-pipeline
34+
timeouts:
35+
pipeline: 6h
3436
workspaces:
3537
- name: git-auth
3638
secret:

.tekton/cuda/cuda-pull-request.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ spec:
3333
value: container-images/cuda/Containerfile
3434
pipelineRef:
3535
name: pull-request-pipeline
36+
timeouts:
37+
pipeline: 6h
3638
workspaces:
3739
- name: git-auth
3840
secret:

.tekton/cuda/cuda-push.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ spec:
3030
value: container-images/cuda/Containerfile
3131
pipelineRef:
3232
name: push-pipeline
33+
timeouts:
34+
pipeline: 6h
3335
workspaces:
3436
- name: git-auth
3537
secret:

.tekton/pipelines/pull-request-pipeline.yaml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
description: Force rebuild image
3434
name: rebuild
3535
type: string
36-
- default: "false"
36+
- default: "true"
3737
description: Skip checks against built image
3838
name: skip-checks
3939
type: string
@@ -76,6 +76,18 @@ spec:
7676
set of values is determined by the configuration of the multi-platform-controller.
7777
name: build-platforms
7878
type: array
79+
- default: ""
80+
description: The image to use for running tests.
81+
name: test-image
82+
- default: []
83+
description: List of environment variables (NAME=VALUE) to be set in the test environment.
84+
name: test-envs
85+
type: array
86+
- default:
87+
- echo "No tests defined"
88+
description: List of test commands to run after the image is built.
89+
name: test-commands
90+
type: array
7991
results:
8092
- description: ""
8193
name: IMAGE_URL
@@ -241,6 +253,42 @@ spec:
241253
operator: in
242254
values:
243255
- "true"
256+
- name: wait-for-test-image
257+
params:
258+
- name: ref
259+
value: $(params.test-image)
260+
runAfter:
261+
- build-image-index
262+
taskRef:
263+
name: wait-for-image
264+
when:
265+
- input: $(params.test-image)
266+
operator: notin
267+
values:
268+
- ""
269+
- name: run-tests
270+
matrix:
271+
params:
272+
- name: cmd
273+
value:
274+
- $(params.test-commands)
275+
params:
276+
- name: image
277+
value: $(params.test-image)@$(tasks.wait-for-test-image.results.digest)
278+
- name: source-artifact
279+
value: $(tasks.prefetch-dependencies.results.SOURCE_ARTIFACT)
280+
- name: envs
281+
value:
282+
- $(params.test-envs[*])
283+
runAfter:
284+
- wait-for-test-image
285+
taskRef:
286+
name: test-cmd
287+
when:
288+
- input: $(params.test-image)
289+
operator: notin
290+
values:
291+
- ""
244292
- name: build-source-image
245293
params:
246294
- name: BINARY_IMAGE

.tekton/pipelines/push-pipeline.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ spec:
7676
set of values is determined by the configuration of the multi-platform-controller.
7777
name: build-platforms
7878
type: array
79+
- default: ""
80+
description: The image to use for running tests.
81+
name: test-image
82+
- default: []
83+
description: List of environment variables (NAME=VALUE) to be set in the test environment.
84+
name: test-envs
85+
type: array
86+
- default:
87+
- echo "No tests defined"
88+
description: List of test commands to run after the image is built.
89+
name: test-commands
90+
type: array
7991
results:
8092
- description: ""
8193
name: IMAGE_URL
@@ -241,6 +253,42 @@ spec:
241253
operator: in
242254
values:
243255
- "true"
256+
- name: wait-for-test-image
257+
params:
258+
- name: ref
259+
value: $(params.test-image)
260+
runAfter:
261+
- build-image-index
262+
taskRef:
263+
name: wait-for-image
264+
when:
265+
- input: $(params.test-image)
266+
operator: notin
267+
values:
268+
- ""
269+
- name: run-tests
270+
matrix:
271+
params:
272+
- name: cmd
273+
value:
274+
- $(params.test-commands)
275+
params:
276+
- name: image
277+
value: $(params.test-image)@$(tasks.wait-for-test-image.results.digest)
278+
- name: source-artifact
279+
value: $(tasks.prefetch-dependencies.results.SOURCE_ARTIFACT)
280+
- name: envs
281+
value:
282+
- $(params.test-envs[*])
283+
runAfter:
284+
- wait-for-test-image
285+
taskRef:
286+
name: test-cmd
287+
when:
288+
- input: $(params.test-image)
289+
operator: notin
290+
values:
291+
- ""
244292
- name: build-source-image
245293
params:
246294
- name: BINARY_IMAGE

.tekton/ramalama/ramalama-pull-request.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,21 @@ spec:
3232
- linux/arm64
3333
- name: dockerfile
3434
value: container-images/ramalama/Containerfile
35+
- name: test-image
36+
value: quay.io/redhat-user-workloads/ramalama-tenant/bats:on-pr-{{revision}}
37+
- name: test-envs
38+
value:
39+
- RAMALAMA_IMAGE=quay.io/redhat-user-workloads/ramalama-tenant/ramalama:on-pr-{{revision}}
40+
- name: test-commands
41+
value:
42+
- make validate
43+
- make bats-nocontainer
44+
- make unit-tests
45+
- make cov-tests
3546
pipelineRef:
3647
name: pull-request-pipeline
48+
timeouts:
49+
pipeline: 6h
3750
workspaces:
3851
- name: git-auth
3952
secret:

.tekton/ramalama/ramalama-push.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,21 @@ spec:
2929
- linux/arm64
3030
- name: dockerfile
3131
value: container-images/ramalama/Containerfile
32+
- name: test-image
33+
value: quay.io/redhat-user-workloads/ramalama-tenant/bats:{{revision}}
34+
- name: test-envs
35+
value:
36+
- RAMALAMA_IMAGE=quay.io/redhat-user-workloads/ramalama-tenant/ramalama:{{revision}}
37+
- name: test-commands
38+
value:
39+
- make validate
40+
- make bats-nocontainer
41+
- make unit-tests
42+
- make cov-tests
3243
pipelineRef:
3344
name: push-pipeline
45+
timeouts:
46+
pipeline: 6h
3447
workspaces:
3548
- name: git-auth
3649
secret:

.tekton/rocm-ubi/rocm-ubi-pull-request.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ spec:
3333
value: container-images/rocm-ubi/Containerfile
3434
pipelineRef:
3535
name: pull-request-pipeline
36+
timeouts:
37+
pipeline: 6h
3638
workspaces:
3739
- name: git-auth
3840
secret:

.tekton/rocm-ubi/rocm-ubi-push.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ spec:
3030
value: container-images/rocm-ubi/Containerfile
3131
pipelineRef:
3232
name: push-pipeline
33+
timeouts:
34+
pipeline: 6h
3335
workspaces:
3436
- name: git-auth
3537
secret:

0 commit comments

Comments
 (0)