From fc65c0ac41215775d88bb65dcceef2ce4b3e4fc6 Mon Sep 17 00:00:00 2001 From: Maor Friedman Date: Mon, 2 Dec 2024 13:44:58 +0200 Subject: [PATCH] feat(RELEASE-1310) add update-cr-status to push-disk-images Signed-off-by: Maor Friedman --- pipelines/push-disk-images-to-cdn/README.md | 4 ++++ .../push-disk-images-to-cdn.yaml | 24 ++++++++++++++++++- tasks/push-disk-images/README.md | 4 ++++ tasks/push-disk-images/push-disk-images.yaml | 8 ++++++- ...test-push-disk-images-fail-ir-failure.yaml | 3 +++ ...sk-images-fail-no-contentgateway-data.yaml | 5 +++- .../test-push-disk-images-fail-no-data.yaml | 5 +++- ...est-push-disk-images-fail-no-snapshot.yaml | 5 +++- .../test-push-disk-images-production.yaml | 3 +++ .../tests/test-push-disk-images-qa.yaml | 3 +++ .../tests/test-push-disk-images-stage.yaml | 3 +++ 11 files changed, 62 insertions(+), 5 deletions(-) diff --git a/pipelines/push-disk-images-to-cdn/README.md b/pipelines/push-disk-images-to-cdn/README.md index 7252ec7c8..0a6b0fa55 100644 --- a/pipelines/push-disk-images-to-cdn/README.md +++ b/pipelines/push-disk-images-to-cdn/README.md @@ -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 diff --git a/pipelines/push-disk-images-to-cdn/push-disk-images-to-cdn.yaml b/pipelines/push-disk-images-to-cdn/push-disk-images-to-cdn.yaml index d54484ed5..106f799c4 100644 --- a/pipelines/push-disk-images-to-cdn/push-disk-images-to-cdn.yaml +++ b/pipelines/push-disk-images-to-cdn/push-disk-images-to-cdn.yaml @@ -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 @@ -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)" @@ -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: diff --git a/tasks/push-disk-images/README.md b/tasks/push-disk-images/README.md index 013b097d0..f59beaeb7 100644 --- a/tasks/push-disk-images/README.md +++ b/tasks/push-disk-images/README.md @@ -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 diff --git a/tasks/push-disk-images/push-disk-images.yaml b/tasks/push-disk-images/push-disk-images.yaml index b75781ed9..4b1691be0 100644 --- a/tasks/push-disk-images/push-disk-images.yaml +++ b/tasks/push-disk-images/push-disk-images.yaml @@ -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 @@ -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 @@ -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="" diff --git a/tasks/push-disk-images/tests/test-push-disk-images-fail-ir-failure.yaml b/tasks/push-disk-images/tests/test-push-disk-images-fail-ir-failure.yaml index 115211a04..b13c450d0 100644 --- a/tasks/push-disk-images/tests/test-push-disk-images-fail-ir-failure.yaml +++ b/tasks/push-disk-images/tests/test-push-disk-images-fail-ir-failure.yaml @@ -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", @@ -71,6 +72,8 @@ spec: value: "data.json" - name: pipelineRunUid value: $(context.pipelineRun.uid) + - name: resultsDirPath + value: results runAfter: - setup workspaces: diff --git a/tasks/push-disk-images/tests/test-push-disk-images-fail-no-contentgateway-data.yaml b/tasks/push-disk-images/tests/test-push-disk-images-fail-no-contentgateway-data.yaml index d72369781..5eb8c4c4d 100644 --- a/tasks/push-disk-images/tests/test-push-disk-images-fail-no-contentgateway-data.yaml +++ b/tasks/push-disk-images/tests/test-push-disk-images-fail-no-contentgateway-data.yaml @@ -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": { @@ -40,6 +41,8 @@ spec: value: "data.json" - name: pipelineRunUid value: $(context.pipelineRun.uid) + - name: resultsDirPath + value: results runAfter: - setup workspaces: diff --git a/tasks/push-disk-images/tests/test-push-disk-images-fail-no-data.yaml b/tasks/push-disk-images/tests/test-push-disk-images-fail-no-data.yaml index 7a0f215b7..cac4482f3 100644 --- a/tasks/push-disk-images/tests/test-push-disk-images-fail-no-data.yaml +++ b/tasks/push-disk-images/tests/test-push-disk-images-fail-no-data.yaml @@ -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", @@ -50,6 +51,8 @@ spec: value: "data.json" - name: pipelineRunUid value: $(context.pipelineRun.uid) + - name: resultsDirPath + value: results runAfter: - setup workspaces: diff --git a/tasks/push-disk-images/tests/test-push-disk-images-fail-no-snapshot.yaml b/tasks/push-disk-images/tests/test-push-disk-images-fail-no-snapshot.yaml index 6a91474ec..261a9e609 100644 --- a/tasks/push-disk-images/tests/test-push-disk-images-fail-no-snapshot.yaml +++ b/tasks/push-disk-images/tests/test-push-disk-images-fail-no-snapshot.yaml @@ -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": { @@ -52,6 +53,8 @@ spec: value: "data.json" - name: pipelineRunUid value: $(context.pipelineRun.uid) + - name: resultsDirPath + value: results runAfter: - setup workspaces: diff --git a/tasks/push-disk-images/tests/test-push-disk-images-production.yaml b/tasks/push-disk-images/tests/test-push-disk-images-production.yaml index f160f607f..b41cef7d7 100644 --- a/tasks/push-disk-images/tests/test-push-disk-images-production.yaml +++ b/tasks/push-disk-images/tests/test-push-disk-images-production.yaml @@ -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", @@ -68,6 +69,8 @@ spec: value: "data.json" - name: pipelineRunUid value: $(context.pipelineRun.uid) + - name: resultsDirPath + value: results runAfter: - setup workspaces: diff --git a/tasks/push-disk-images/tests/test-push-disk-images-qa.yaml b/tasks/push-disk-images/tests/test-push-disk-images-qa.yaml index d69290ccd..c18ae00ea 100644 --- a/tasks/push-disk-images/tests/test-push-disk-images-qa.yaml +++ b/tasks/push-disk-images/tests/test-push-disk-images-qa.yaml @@ -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", @@ -68,6 +69,8 @@ spec: value: "data.json" - name: pipelineRunUid value: $(context.pipelineRun.uid) + - name: resultsDirPath + value: results runAfter: - setup workspaces: diff --git a/tasks/push-disk-images/tests/test-push-disk-images-stage.yaml b/tasks/push-disk-images/tests/test-push-disk-images-stage.yaml index cd5012775..a320e80cc 100644 --- a/tasks/push-disk-images/tests/test-push-disk-images-stage.yaml +++ b/tasks/push-disk-images/tests/test-push-disk-images-stage.yaml @@ -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", @@ -68,6 +69,8 @@ spec: value: "data.json" - name: pipelineRunUid value: $(context.pipelineRun.uid) + - name: resultsDirPath + value: results runAfter: - setup workspaces: