-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #853 from tkdchen/STONEBLD-1608-show-source-image-…
…in-summary-rework Show source image URL in summary
- Loading branch information
Showing
5 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Migration from 0.1 to 0.2 | ||
|
||
Task `summary` can be optionally mounted to the shared workspace in order to show source container image URL. Apply the following diff to task `show-summary` in the PipelineRun YAMLs generated by Konflux bot. | ||
|
||
```diff | ||
value: $(params.output-image) | ||
- name: build-task-status | ||
value: $(tasks.build-container.status) | ||
+ workspaces: | ||
+ - name: workspace | ||
+ workspace: workspace | ||
results: | ||
- name: IMAGE_URL | ||
value: "$(tasks.build-container.results.IMAGE_URL)" | ||
``` | ||
|
||
This update to the PipelineRun is optional. The build pipeline can run normally without the mount. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# summary task | ||
|
||
Summary Pipeline Task. Prints PipelineRun information, removes image repository secret used by the PipelineRun. | ||
|
||
## Parameters | ||
|name|description|default value|required| | ||
|---|---|---|---| | ||
|pipelinerun-name|pipeline-run to annotate||true| | ||
|git-url|Git URL||true| | ||
|image-url|Image URL||true| | ||
|build-task-status|State of build task in pipelineRun|Succeeded|false| | ||
|
||
## Workspaces | ||
|name|description|optional| | ||
|---|---|---| | ||
|workspace|The workspace where source code is included.|true| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: tekton.dev/v1 | ||
kind: Task | ||
metadata: | ||
labels: | ||
app.kubernetes.io/version: "0.2" | ||
annotations: | ||
tekton.dev/pipelines.minVersion: "0.12.1" | ||
tekton.dev/tags: "appstudio, hacbs" | ||
name: summary | ||
spec: | ||
description: >- | ||
Summary Pipeline Task. Prints PipelineRun information, removes image repository secret used by the PipelineRun. | ||
params: | ||
- name: pipelinerun-name | ||
description: pipeline-run to annotate | ||
- name: git-url | ||
description: Git URL | ||
- name: image-url | ||
description: Image URL | ||
- name: build-task-status | ||
description: State of build task in pipelineRun | ||
# Default Succeeded for backward compatibility | ||
default: Succeeded | ||
workspaces: | ||
- name: workspace | ||
description: The workspace where source code is included. | ||
optional: true | ||
steps: | ||
- name: appstudio-summary | ||
image: quay.io/redhat-appstudio/task-toolset@sha256:931a9f7886586391ccb38d33fd15a47eb03568f9b19512b0a57a56384fa52a3c | ||
# per https://kubernetes.io/docs/concepts/containers/images/#imagepullpolicy-defaulting | ||
# the cluster will set imagePullPolicy to IfNotPresent | ||
# also per direction from Ralph Bean, we want to use image digest based tags to use a cue to automation like dependabot or renovatebot to periodially submit pull requests that update the digest as new images are released. | ||
env: | ||
- name: GIT_URL | ||
value: $(params.git-url) | ||
- name: IMAGE_URL | ||
value: $(params.image-url) | ||
- name: PIPELINERUN_NAME | ||
value: $(params.pipelinerun-name) | ||
- name: BUILD_TASK_STATUS | ||
value: $(params.build-task-status) | ||
- name: SOURCE_BUILD_RESULT_FILE | ||
value: "$(workspaces.workspace.path)/source_build_result.json" | ||
script: | | ||
#!/usr/bin/env bash | ||
echo | ||
echo "Build Summary:" | ||
echo | ||
echo "Build repository: $GIT_URL" | ||
if [ "$BUILD_TASK_STATUS" == "Succeeded" ]; then | ||
echo "Generated Image is in : $IMAGE_URL" | ||
fi | ||
if [ -e "$SOURCE_BUILD_RESULT_FILE" ]; then | ||
url=$(jq -r ".image_url" <"$SOURCE_BUILD_RESULT_FILE") | ||
echo "Generated Source Image is in : $url" | ||
fi | ||
echo | ||
echo End Summary |