Skip to content

Commit

Permalink
feat: write build file image URL as task result
Browse files Browse the repository at this point in the history
Signed-off-by: Chenxiong Qi <[email protected]>
  • Loading branch information
tkdchen committed Jul 12, 2024
1 parent 6902b2e commit 4ab687c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions task/push-build-file-oci-ta/0.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ Discover build file from source code and push it to registry as an OCI artifact.
|SOURCE_ARTIFACT|The Trusted Artifact URI pointing to the artifact with the application source code.||true|
|TAG_SUFFIX|Suffix of the build file image tag.|.dockerfile|false|

## Results
|name|description|
|---|---|
|IMAGE_URL|Digest-pinned image URL.|

9 changes: 8 additions & 1 deletion task/push-build-file-oci-ta/0.1/push-build-file-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ spec:
description: Suffix of the build file image tag.
type: string
default: .dockerfile
results:
- name: IMAGE_URL
description: Digest-pinned image URL.
volumes:
- name: workdir
emptyDir: {}
Expand Down Expand Up @@ -70,6 +73,8 @@ spec:
value: $(params.CONTEXT)
- name: ARTIFACT_TYPE
value: $(params.ARTIFACT_TYPE)
- name: IMAGE_URL_RESULT
value: $(results.IMAGE_URL.path)
script: |
# Same discovery logic used in buildah task
SOURCE_CODE_DIR=source
Expand Down Expand Up @@ -98,6 +103,8 @@ spec:
cd "$(dirname $build_file_path)"
retry oras push --no-tty \
--format json \
--registry-config "$auth_json" \
--artifact-type "$ARTIFACT_TYPE" \
"$build_file_image" "$(basename $build_file_path)"
"$build_file_image" "$(basename $build_file_path)" |
yq '.reference' >"$IMAGE_URL_RESULT"
5 changes: 5 additions & 0 deletions task/push-build-file/0.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Discover build file from source code and push it to registry as an OCI artifact.
|TAG_SUFFIX|Suffix of the build file image tag.|.dockerfile|false|
|ARTIFACT_TYPE|Artifact type of the build file image.|application/vnd.konflux.dockerfile|false|

## Results
|name|description|
|---|---|
|IMAGE_URL|Digest-pinned image URL.|

## Workspaces
|name|description|optional|
|---|---|---|
Expand Down
9 changes: 8 additions & 1 deletion task/push-build-file/0.1/push-build-file.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ spec:
description: Artifact type of the build file image.
type: string
default: application/vnd.konflux.dockerfile
results:
- name: IMAGE_URL
description: Digest-pinned image URL.
steps:
- name: push
image: quay.io/konflux-ci/oras@sha256:5d0a8a5535fcc4ba467264cacbdeab2fb8662a538a61cb7fc8b3155e3f20fa39
Expand All @@ -51,6 +54,8 @@ spec:
value: $(params.CONTEXT)
- name: ARTIFACT_TYPE
value: $(params.ARTIFACT_TYPE)
- name: IMAGE_URL_RESULT
value: $(results.IMAGE_URL.path)
script: |
# Same discovery logic used in buildah task
SOURCE_CODE_DIR=source
Expand Down Expand Up @@ -79,9 +84,11 @@ spec:
cd "$(dirname $build_file_path)"
retry oras push --no-tty \
--format json \
--registry-config "$auth_json" \
--artifact-type "$ARTIFACT_TYPE" \
"$build_file_image" "$(basename $build_file_path)"
"$build_file_image" "$(basename $build_file_path)" \
| yq '.reference' >"$IMAGE_URL_RESULT"
workspaces:
- name: workspace
Expand Down

0 comments on commit 4ab687c

Please sign in to comment.