diff --git a/internal/resources/create-advisory.yaml b/internal/resources/create-advisory.yaml deleted file mode 120000 index 4a6af64c0..000000000 --- a/internal/resources/create-advisory.yaml +++ /dev/null @@ -1 +0,0 @@ -../pipelines/create-advisory/create-advisory.yaml \ No newline at end of file diff --git a/internal/pipelines/create-advisory/README.md b/pipelines/internal/create-advisory/README.md similarity index 100% rename from internal/pipelines/create-advisory/README.md rename to pipelines/internal/create-advisory/README.md diff --git a/internal/pipelines/create-advisory/create-advisory.yaml b/pipelines/internal/create-advisory/create-advisory.yaml similarity index 100% rename from internal/pipelines/create-advisory/create-advisory.yaml rename to pipelines/internal/create-advisory/create-advisory.yaml diff --git a/tasks/managed/create-advisory/README.md b/tasks/managed/create-advisory/README.md index 29849bfd2..6199d4985 100644 --- a/tasks/managed/create-advisory/README.md +++ b/tasks/managed/create-advisory/README.md @@ -22,6 +22,10 @@ Only all `redhat-pending` or all `redhat-prod` repositories may be specified in ## Changes in 5.0.0 * Added taskGiturl and taskGitRevision parameters to be passed to the internalRequest +* The pipeline is called via git resolver now instead of cluster resolver + * This was done by changing from `-r` to `--pipeline` in the `internal-request` call + * The base image was updated to include this new functionality +* Updated logic to determine InternalRequest name more reliably ## Changes in 4.4.3 * Pass the errata service account secret name to the InternalRequest based on stage or prod diff --git a/tasks/managed/create-advisory/create-advisory.yaml b/tasks/managed/create-advisory/create-advisory.yaml index 12137144e..37e836d0b 100644 --- a/tasks/managed/create-advisory/create-advisory.yaml +++ b/tasks/managed/create-advisory/create-advisory.yaml @@ -53,7 +53,7 @@ spec: description: The advisory url if one was created steps: - name: run-script - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | #!/bin/bash set -ex @@ -165,7 +165,7 @@ spec: fi echo "Creating InternalRequest to create advisory..." - internal-request -r "$(params.request)" \ + internal-request --pipeline "$(params.request)" \ -p application="${application}" \ -p origin="${origin}" \ -p advisory_json="${advisoryData}" \ @@ -179,7 +179,7 @@ spec: > "$(workspaces.data.path)"/ir-result.txt || \ (grep "^\[" "$(workspaces.data.path)"/ir-result.txt | jq . && exit 1) - internalRequest=$(awk 'NR==1{ print $2 }' "$(workspaces.data.path)"/ir-result.txt | xargs) + internalRequest=$(awk -F"'" '/created/ { print $2 }' "$(workspaces.data.path)"/ir-result.txt) echo "done (${internalRequest})" echo -n "" > "$(results.advisory_url.path)" diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-default-type.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-default-type.yaml index 414676aed..8d5b1a7fd 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-default-type.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-default-type.yaml @@ -14,7 +14,7 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | #!/usr/bin/env bash set -eux @@ -126,7 +126,7 @@ spec: - name: data steps: - name: check-result - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | #!/usr/bin/env bash set -ex @@ -142,9 +142,10 @@ spec: internalRequest=$(kubectl get InternalRequest -o json | jq -r '.items[0]') - # Check the request field - if [ "$(echo "$internalRequest" | jq -r '.spec.request' )" != "create-advisory" ]; then - echo "InternalRequest doesn't contain 'create-advisory' in 'request' field" + # Check if the 'pipelineRef' field contains the 'create-advisory' pipeline + if [[ "$(echo "$internalRequest" | jq -r '.spec.pipeline.pipelineRef.params[2].value' )" != \ + "pipelines/internal/create-advisory"* ]]; then + echo "InternalRequest doesn't contain 'create-advisory' in 'pipeline' field" exit 1 fi @@ -172,9 +173,9 @@ spec: taskSpec: steps: - name: delete-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux kubectl delete internalrequests --all diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-fail-both-prod-and-pending.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-fail-both-prod-and-pending.yaml index f4ef40f04..c3d0c6da3 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-fail-both-prod-and-pending.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-fail-both-prod-and-pending.yaml @@ -16,9 +16,9 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux mkdir "$(workspaces.data.path)"/results diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-data.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-data.yaml index a2fef9935..d22e9cd0a 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-data.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-data.yaml @@ -15,9 +15,9 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux mkdir $(workspaces.data.path)/results diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-prod-or-pending.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-prod-or-pending.yaml index 491a8eefc..692f68f32 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-prod-or-pending.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-prod-or-pending.yaml @@ -16,7 +16,7 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | #!/usr/bin/env bash set -eux diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-rpa.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-rpa.yaml index ecec92e58..bfa1e1e37 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-rpa.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-rpa.yaml @@ -15,9 +15,9 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux mkdir "$(workspaces.data.path)/results" diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-snapshot.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-snapshot.yaml index 4b8a5b61b..9d991f17d 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-snapshot.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-fail-no-snapshot.yaml @@ -15,9 +15,9 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux mkdir "$(workspaces.data.path)"/results diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-fail-orphan.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-fail-orphan.yaml index bac1403c4..dcb0364d5 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-fail-orphan.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-fail-orphan.yaml @@ -16,9 +16,9 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux mkdir $(workspaces.data.path)/results diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-fail-rhsa-no-cve.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-fail-rhsa-no-cve.yaml index 178990f54..91b8e46c7 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-fail-rhsa-no-cve.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-fail-rhsa-no-cve.yaml @@ -16,7 +16,7 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | #!/usr/bin/env bash set -eux diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-fail-wrong-type.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-fail-wrong-type.yaml index 362e05706..96f24021e 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-fail-wrong-type.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-fail-wrong-type.yaml @@ -16,9 +16,9 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux mkdir $(workspaces.data.path)/results diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-overwrite-type.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-overwrite-type.yaml index 879d3220c..584d77a51 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-overwrite-type.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-overwrite-type.yaml @@ -14,7 +14,7 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | #!/usr/bin/env bash set -eux @@ -136,7 +136,7 @@ spec: - name: data steps: - name: check-result - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | #!/usr/bin/env bash set -ex @@ -152,10 +152,11 @@ spec: internalRequest=$(kubectl get InternalRequest -o json | jq -r '.items[0]') - # Check the request field - if [ "$(echo "$internalRequest" | jq -r '.spec.request' )" != "create-advisory" ]; then - echo "InternalRequest doesn't contain 'create-advisory' in 'request' field" - exit 1 + # Check if the 'pipelineRef' field contains the 'create-advisory' pipeline + if [[ "$(echo "$internalRequest" | jq -r '.spec.pipeline.pipelineRef.params[2].value' )" != \ + "pipelines/internal/create-advisory"* ]]; then + echo "InternalRequest doesn't contain 'create-advisory' in 'pipeline' field" + exit 1 fi # Check the advisory_json parameter @@ -182,9 +183,9 @@ spec: taskSpec: steps: - name: delete-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux kubectl delete internalrequests --all diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-pending-repo.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-pending-repo.yaml index fbbef9fe7..09d2f6916 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-pending-repo.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-pending-repo.yaml @@ -14,9 +14,9 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux mkdir $(workspaces.data.path)/results @@ -124,9 +124,9 @@ spec: - name: data steps: - name: check-result - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/bin/sh + #!/bin/bash set -ex # Count the number of InternalRequests @@ -140,10 +140,11 @@ spec: internalRequest=$(kubectl get InternalRequest -o json | jq -r '.items[0]') - # Check the request field - if [ "$(echo "$internalRequest" | jq -r '.spec.request' )" != "create-advisory" ]; then - echo "InternalRequest doesn't contain 'create-advisory' in 'request' field" - exit 1 + # Check if the 'pipelineRef' field contains the 'create-advisory' pipeline + if [[ "$(echo "$internalRequest" | jq -r '.spec.pipeline.pipelineRef.params[2].value' )" != \ + "pipelines/internal/create-advisory"* ]]; then + echo "InternalRequest doesn't contain 'create-advisory' in 'pipeline' field" + exit 1 fi # Check the application parameter @@ -195,9 +196,9 @@ spec: taskSpec: steps: - name: delete-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux kubectl delete internalrequests --all diff --git a/tasks/managed/create-advisory/tests/test-create-advisory-prod-repo.yaml b/tasks/managed/create-advisory/tests/test-create-advisory-prod-repo.yaml index 2705d6ece..8eadcda38 100644 --- a/tasks/managed/create-advisory/tests/test-create-advisory-prod-repo.yaml +++ b/tasks/managed/create-advisory/tests/test-create-advisory-prod-repo.yaml @@ -14,9 +14,9 @@ spec: taskSpec: steps: - name: create-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux mkdir $(workspaces.data.path)/results @@ -126,9 +126,9 @@ spec: - name: data steps: - name: check-result - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/bin/sh + #!/bin/bash set -ex # Count the number of InternalRequests @@ -142,10 +142,11 @@ spec: internalRequest=$(kubectl get InternalRequest -o json | jq -r '.items[0]') - # Check the request field - if [ "$(echo "$internalRequest" | jq -r '.spec.request' )" != "create-advisory" ]; then - echo "InternalRequest doesn't contain 'create-advisory' in 'request' field" - exit 1 + # Check if the 'pipelineRef' field contains the 'create-advisory' pipeline + if [[ "$(echo "$internalRequest" | jq -r '.spec.pipeline.pipelineRef.params[2].value' )" != \ + "pipelines/internal/create-advisory"* ]]; then + echo "InternalRequest doesn't contain 'create-advisory' in 'pipeline' field" + exit 1 fi # Check the application parameter @@ -210,9 +211,9 @@ spec: taskSpec: steps: - name: delete-crs - image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f + image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 script: | - #!/usr/bin/env sh + #!/usr/bin/env bash set -eux kubectl delete internalrequests --all