Skip to content

Commit

Permalink
feat(RELEASE-1329): create-advisory pipeline is called via git resolver
Browse files Browse the repository at this point in the history
This commit updates the managed task that calls the create-advisory
internal pipeline to call the pipeline via git resolver instead of
cluster resolver. It also moves the internal create-advisory pipeline to
its proper directory, which is where the internal-request script expects
it.

Signed-off-by: Johnny Bieren <[email protected]>
  • Loading branch information
johnbieren committed Jan 29, 2025
1 parent 112c668 commit d545e09
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 53 deletions.
1 change: 0 additions & 1 deletion internal/resources/create-advisory.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions tasks/managed/create-advisory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tasks/managed/create-advisory/create-advisory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}" \
Expand All @@ -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)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit d545e09

Please sign in to comment.