Skip to content

Commit

Permalink
feat(RELEASE-1323): create-advisory internal task uses git resolver (#…
Browse files Browse the repository at this point in the history
…793)

This commit updates the create-advisory internal pipeline to call its
one task via git resolver. The pipeline itself still uses a cluster
resolver, which will be changed in a separate commit.

Signed-off-by: Johnny Bieren <[email protected]>
  • Loading branch information
johnbieren authored Jan 29, 2025
1 parent 37e8cf7 commit 112c668
Show file tree
Hide file tree
Showing 19 changed files with 147 additions and 13 deletions.
21 changes: 13 additions & 8 deletions internal/pipelines/create-advisory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ advisory URL as well as a result to show the error message if one occurred.

## Parameters

| Name | Description | Optional | Default value |
|----------------------|--------------------------------------------------------------------------------------------------------|----------|---------------|
| advisory_json | String containing a JSON representation of the advisory data (e.g. '{"product_id":123,"type":"RHSA"}') | No | - |
| application | Application being released | No | - |
| origin | The origin workspace where the release CR comes from. This is used to determine the advisory path | No | - |
| config_map_name | The name of the configMap that contains the signing key | No | - |
| advisory_secret_name | The name of the secret that contains the advisory creation metadata | No | - |
| errata_secret_name | The name of the secret that contains the errata service account metadata | No | - |
| Name | Description | Optional | Default value |
|----------------------|--------------------------------------------------------------------------------------------------------|----------|-----------------------------------------------------------|
| advisory_json | String containing a JSON representation of the advisory data (e.g. '{"product_id":123,"type":"RHSA"}') | No | - |
| application | Application being released | No | - |
| origin | The origin workspace where the release CR comes from. This is used to determine the advisory path | No | - |
| config_map_name | The name of the configMap that contains the signing key | No | - |
| advisory_secret_name | The name of the secret that contains the advisory creation metadata | No | - |
| errata_secret_name | The name of the secret that contains the errata service account metadata | No | - |
| 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.0.0
* Added taskGiturl and taskGitRevision parameters so the task can be called via git resolvers
18 changes: 16 additions & 2 deletions internal/pipelines/create-advisory/create-advisory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Pipeline
metadata:
name: create-advisory
labels:
app.kubernetes.io/version: "0.5.0"
app.kubernetes.io/version: "1.0.0"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: advisory
Expand Down Expand Up @@ -33,10 +33,24 @@ spec:
- name: errata_secret_name
type: string
description: The name of the secret that contains the errata service account metadata
- name: taskGitUrl
type: string
description: The url to the git repo where the release-service-catalog tasks to be used are stored
default: https://github.com/konflux-ci/release-service-catalog.git
- name: taskGitRevision
type: string
description: The revision in the taskGitUrl repo to be used
tasks:
- name: create-advisory-task
taskRef:
name: create-advisory-task
resolver: "git"
params:
- name: url
value: $(params.taskGitUrl)
- name: revision
value: $(params.taskGitRevision)
- name: pathInRepo
value: tasks/internal/create-advisory-task/create-advisory-task.yaml
params:
- name: advisory_json
value: $(params.advisory_json)
Expand Down
1 change: 0 additions & 1 deletion internal/resources/create-advisory-task.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions pipelines/managed/rh-advisories/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ the rh-push-to-registry-redhat-io pipeline.
| 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.8.4
* Pass taskGitUrl and taskGitRevision to create-advisory task

## Changes in 1.8.3
* Pass taskGitUrl and taskGitRevision to run-file-updates task

Expand Down
6 changes: 5 additions & 1 deletion pipelines/managed/rh-advisories/rh-advisories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Pipeline
metadata:
name: rh-advisories
labels:
app.kubernetes.io/version: "1.8.3"
app.kubernetes.io/version: "1.8.4"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand Down Expand Up @@ -679,6 +679,10 @@ spec:
value: "$(tasks.collect-data.results.resultsDir)"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: $(params.taskGitUrl)
- name: taskGitRevision
value: $(params.taskGitRevision)
taskRef:
params:
- name: url
Expand Down
5 changes: 5 additions & 0 deletions tasks/managed/create-advisory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Only all `redhat-pending` or all `redhat-prod` repositories may be specified in
| request | Type of request to be created | Yes | create-advisory |
| synchronously | Whether the task should wait for InternalRequests to complete | Yes | true |
| pipelineRunUid | The uid of the current pipelineRun. Used as a label value when creating internal requests | No | - |
| taskGitUrl | The url to the git repo where the release-service-catalog tasks to be used are stored | No | - |
| taskGitRevision | The revision in the taskGitUrl repo to be used | No | - |

## Changes in 5.0.0
* Added taskGiturl and taskGitRevision parameters to be passed to the internalRequest

## Changes in 4.4.3
* Pass the errata service account secret name to the InternalRequest based on stage or prod
Expand Down
10 changes: 9 additions & 1 deletion tasks/managed/create-advisory/create-advisory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Task
metadata:
name: create-advisory
labels:
app.kubernetes.io/version: "4.4.3"
app.kubernetes.io/version: "5.0.0"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand Down Expand Up @@ -39,6 +39,12 @@ spec:
- name: pipelineRunUid
type: string
description: The uid of the current pipelineRun. Used as a label value when creating internal requests
- name: taskGitUrl
type: string
description: The url to the git repo where the release-service-catalog tasks to be used are stored
- name: taskGitRevision
type: string
description: The revision in the taskGitUrl repo to be used
workspaces:
- name: data
description: Workspace where the json files are stored
Expand Down Expand Up @@ -166,6 +172,8 @@ spec:
-p config_map_name="${configMapName}" \
-p advisory_secret_name="${advisorySecretName}" \
-p errata_secret_name="${errataSecretName}" \
-p taskGitUrl="$(params.taskGitUrl)" \
-p taskGitRevision="$(params.taskGitRevision)" \
-s "$(params.synchronously)" \
-l ${pipelinerun_label}="$(params.pipelineRunUid)" \
> "$(workspaces.data.path)"/ir-result.txt || \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down Expand Up @@ -151,6 +155,18 @@ spec:
echo "and no type was initially provided in the releaseNotes."
exit 1
fi
# Check the taskGitUrl parameter
if [ "$(echo "$internalRequest" | jq -r '.spec.params.taskGitUrl' )" != "http://localhost" ]; then
echo "InternalRequest has the wrong taskGitUrl parameter"
exit 1
fi
# Check the taskGitRevision parameter
if [ "$(echo "$internalRequest" | jq -r '.spec.params.taskGitRevision' )" != "main" ]; then
echo "InternalRequest has the wrong taskGitRevision parameter"
exit 1
fi
finally:
- name: cleanup
taskSpec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down Expand Up @@ -161,6 +165,18 @@ spec:
echo "in the releaseNotes. However, it was not"
exit 1
fi
# Check the taskGitUrl parameter
if [ "$(echo "$internalRequest" | jq -r '.spec.params.taskGitUrl' )" != "http://localhost" ]; then
echo "InternalRequest has the wrong taskGitUrl parameter"
exit 1
fi
# Check the taskGitRevision parameter
if [ "$(echo "$internalRequest" | jq -r '.spec.params.taskGitRevision' )" != "main" ]; then
echo "InternalRequest has the wrong taskGitRevision parameter"
exit 1
fi
finally:
- name: cleanup
taskSpec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down Expand Up @@ -174,6 +178,18 @@ spec:
echo "InternalRequest has the wrong errata_secret_name parameter"
exit 1
fi
# Check the taskGitUrl parameter
if [ "$(echo "$internalRequest" | jq -r '.spec.params.taskGitUrl' )" != "http://localhost" ]; then
echo "InternalRequest has the wrong taskGitUrl parameter"
exit 1
fi
# Check the taskGitRevision parameter
if [ "$(echo "$internalRequest" | jq -r '.spec.params.taskGitRevision' )" != "main" ]; then
echo "InternalRequest has the wrong taskGitRevision parameter"
exit 1
fi
finally:
- name: cleanup
taskSpec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ spec:
value: "false"
- name: pipelineRunUid
value: $(context.pipelineRun.uid)
- name: taskGitUrl
value: "http://localhost"
- name: taskGitRevision
value: "main"
runAfter:
- setup
workspaces:
Expand Down Expand Up @@ -169,6 +173,18 @@ spec:
exit 1
fi
# Check the taskGitUrl parameter
if [ "$(echo "$internalRequest" | jq -r '.spec.params.taskGitUrl' )" != "http://localhost" ]; then
echo "InternalRequest has the wrong taskGitUrl parameter"
exit 1
fi
# Check the taskGitRevision parameter
if [ "$(echo "$internalRequest" | jq -r '.spec.params.taskGitRevision' )" != "main" ]; then
echo "InternalRequest has the wrong taskGitRevision parameter"
exit 1
fi
echo Test that the advisory_url result was properly set
test "$(echo $(params.advisory_url))" == "https://github.com/org/repo/advisory"
Expand Down

0 comments on commit 112c668

Please sign in to comment.