Skip to content

Commit

Permalink
feat(RELEASE-1310) add update-cr-status to push-disk-images
Browse files Browse the repository at this point in the history
Signed-off-by: Maor Friedman <mafriedm@redhat.com>
  • Loading branch information
maorfr committed Dec 2, 2024
1 parent fe8d948 commit fc65c0a
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 5 deletions.
4 changes: 4 additions & 0 deletions pipelines/push-disk-images-to-cdn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Tekton Pipeline to push disk images to a cdn using pulp
| taskGitUrl | The url to the git repo where the release-service-catalog tasks to be used are stored | Yes | https://github.com/konflux-ci/release-service-catalog.git |
| taskGitRevision | The revision in the taskGitUrl repo to be used | No | - |

## Changes in 1.2.0
* The `push-disk-images` task now gets the `resultsDir` parameter from `collect-data` results
* Add the task `update-cr-status` at the end of the pipeline to save all pipeline results

## Changes in 1.1.0
* Add new reduce-snapshot task

Expand Down
24 changes: 23 additions & 1 deletion pipelines/push-disk-images-to-cdn/push-disk-images-to-cdn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Pipeline
metadata:
name: push-disk-images-to-cdn
labels:
app.kubernetes.io/version: "1.1.0"
app.kubernetes.io/version: "1.2.0"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand Down Expand Up @@ -223,6 +223,8 @@ spec:
value: $(params.taskGitRevision)
- name: pathInRepo
value: tasks/push-disk-images/push-disk-images.yaml
- name: resultsDirPath
value: "$(tasks.collect-data.results.resultsDir)"
params:
- name: dataPath
value: "$(tasks.collect-data.results.data)"
Expand All @@ -235,6 +237,26 @@ spec:
workspace: release-workspace
runAfter:
- check-data-keys
- name: update-cr-status
params:
- name: resource
value: $(params.release)
- name: resultsDirPath
value: $(tasks.collect-data.results.resultsDir)
taskRef:
resolver: "git"
params:
- name: url
value: $(params.taskGitUrl)
- name: revision
value: $(params.taskGitRevision)
- name: pathInRepo
value: tasks/update-cr-status/update-cr-status.yaml
workspaces:
- name: data
workspace: release-workspace
runAfter:
- push-disk-images
finally:
- name: cleanup
taskRef:
Expand Down
4 changes: 4 additions & 0 deletions tasks/push-disk-images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The environment to use is pulled from the `cdn.env` key in the data file.
| snapshotPath | Path to the JSON file of the Snapshot spec in the data workspace | No | - |
| dataPath | Path to data JSON in the data workspace | No | - |
| pipelineRunUid | The uid of the current pipelineRun. Used as a label value when creating internal requests | No | - |
| resultsDirPath | Path to results directory in the data workspace | No | - |

## Changes in 0.3.0
* The task now writes pushed image details to a results json file in the workspace

## Changes in 0.2.2
* Increase the InternalRequest PipelineRun timeout to 24 hours in total
Expand Down
8 changes: 7 additions & 1 deletion tasks/push-disk-images/push-disk-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Task
metadata:
name: push-disk-images
labels:
app.kubernetes.io/version: "0.2.2"
app.kubernetes.io/version: "0.3.0"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand All @@ -22,6 +22,9 @@ spec:
- name: pipelineRunUid
type: string
description: The uid of the current pipelineRun. Used as a label value when creating internal requests
- name: resultsDirPath
description: Path to the results directory in the data workspace
type: string
workspaces:
- name: data
description: Workspace where the json files are stored
Expand All @@ -37,6 +40,9 @@ spec:
# .cdn.env is likely to change in the future. This is just for POC
env=$(jq -r '.cdn.env' "$(workspaces.data.path)/$(params.dataPath)")
RESULTS_FILE="$(workspaces.data.path)/$(params.resultsDirPath)/push-disk-images-results.json"
echo -n "${snapshot}" > $RESULTS_FILE
# There are three envs supported...production, stage, and qa
exodusGwSecret=""
exodusGwEnv=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ spec:
#!/usr/bin/env bash
set -eux
mkdir "$(workspaces.data.path)/results"
cat > "$(workspaces.data.path)/snapshot_spec.json" << EOF
{
"application": "disk-images",
Expand Down Expand Up @@ -71,6 +72,8 @@ spec:
value: "data.json"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: resultsDirPath
value: results
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ spec:
script: |
#!/usr/bin/env bash
set -eux
mkdir "$(workspaces.data.path)/results"
cat > "$(workspaces.data.path)/data.json" << EOF
{
"cdn": {
Expand All @@ -40,6 +41,8 @@ spec:
value: "data.json"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: resultsDirPath
value: results
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ spec:
script: |
#!/usr/bin/env bash
set -eux
mkdir "$(workspaces.data.path)/results"
cat > "$(workspaces.data.path)/test_snapshot_spec.json" << EOF
{
"application": "disk-images",
Expand Down Expand Up @@ -50,6 +51,8 @@ spec:
value: "data.json"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: resultsDirPath
value: results
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ spec:
script: |
#!/usr/bin/env bash
set -eux
mkdir "$(workspaces.data.path)/results"
cat > "$(workspaces.data.path)/data.json" << EOF
{
"contentGateway": {
Expand Down Expand Up @@ -52,6 +53,8 @@ spec:
value: "data.json"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: resultsDirPath
value: results
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
#!/usr/bin/env bash
set -eux
mkdir "$(workspaces.data.path)/results"
cat > "$(workspaces.data.path)/snapshot_spec.json" << EOF
{
"application": "disk-images",
Expand Down Expand Up @@ -68,6 +69,8 @@ spec:
value: "data.json"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: resultsDirPath
value: results
runAfter:
- setup
workspaces:
Expand Down
3 changes: 3 additions & 0 deletions tasks/push-disk-images/tests/test-push-disk-images-qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
#!/usr/bin/env bash
set -eux
mkdir "$(workspaces.data.path)/results"
cat > "$(workspaces.data.path)/snapshot_spec.json" << EOF
{
"application": "disk-images",
Expand Down Expand Up @@ -68,6 +69,8 @@ spec:
value: "data.json"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: resultsDirPath
value: results
runAfter:
- setup
workspaces:
Expand Down
3 changes: 3 additions & 0 deletions tasks/push-disk-images/tests/test-push-disk-images-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
#!/usr/bin/env bash
set -eux
mkdir "$(workspaces.data.path)/results"
cat > "$(workspaces.data.path)/snapshot_spec.json" << EOF
{
"application": "disk-images",
Expand Down Expand Up @@ -68,6 +69,8 @@ spec:
value: "data.json"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: resultsDirPath
value: results
runAfter:
- setup
workspaces:
Expand Down

0 comments on commit fc65c0a

Please sign in to comment.