Skip to content

Commit

Permalink
feat(RELEASE-400): incorporate check-data-keys task in release pipelines
Browse files Browse the repository at this point in the history
This commit adds the check-data-keys task into the
release pipelines to ensure validation of required data keys.

Signed-off-by: Sean Conroy <sconroy@redhat.com>
  • Loading branch information
seanconroy2021 committed Dec 4, 2024
1 parent 070946e commit d7ef3c8
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 16 deletions.
3 changes: 3 additions & 0 deletions pipelines/fbc-release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Tekton release pipeline to interact with FBC 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 4.1.0
* Implement the `check-data-keys` task to validate the `data.json` file using the JSON schema.

## Changes in 4.0.2
* Drop the `binaryImage` param from the task `add-fbc-contribution-to-index-image`, so IIB can auto resolve it.

Expand Down
26 changes: 25 additions & 1 deletion pipelines/fbc-release/fbc-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Pipeline
metadata:
name: fbc-release
labels:
app.kubernetes.io/version: "4.0.2"
app.kubernetes.io/version: "4.1.0"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand Down Expand Up @@ -122,6 +122,30 @@ spec:
workspace: release-workspace
runAfter:
- verify-access-to-resources
- name: check-data-keys
params:
- name: dataPath
value: "$(tasks.collect-data.results.data)"
- name: schema
value: $(params.taskGitUrl)/raw/$(params.taskGitRevision)/schema/dataKeys.json
- name: systems
value:
- fbc
- sign
taskRef:
params:
- name: url
value: $(params.taskGitUrl)
- name: revision
value: $(params.taskGitRevision)
- name: pathInRepo
value: tasks/check-data-keys/check-data-keys.yaml
resolver: git
workspaces:
- name: data
workspace: release-workspace
runAfter:
- collect-data
- name: validate-single-component
taskRef:
resolver: "git"
Expand Down
3 changes: 3 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,9 @@ 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.1
* add new parameter `schema` to the `check-data-keys` task.

## 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
Expand Down
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.2.0"
app.kubernetes.io/version: "1.2.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand Down Expand Up @@ -191,6 +191,8 @@ spec:
params:
- name: dataPath
value: "$(tasks.collect-data.results.data)"
- name: schema
value: $(params.taskGitUrl)/raw/$(params.taskGitRevision)/schema/dataKeys.json
- name: systems
value:
- cdn
Expand Down
3 changes: 3 additions & 0 deletions pipelines/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.5.7
* add new parameter `schema` to the `check-data-keys` task.

## Changes in 1.5.6
* new mandatory parameter resultsDirPath added to run-file-updates task

Expand Down
4 changes: 3 additions & 1 deletion pipelines/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.5.6"
app.kubernetes.io/version: "1.5.7"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand Down Expand Up @@ -509,6 +509,8 @@ spec:
params:
- name: dataPath
value: "$(tasks.collect-data.results.data)"
- name: schema
value: $(params.taskGitUrl)/raw/$(params.taskGitRevision)/schema/dataKeys.json
- name: systems
value:
- releaseNotes
Expand Down
70 changes: 59 additions & 11 deletions schema/dataKeys.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "array",
"items": {
"type": "string",
"enum": ["releaseNotes", "cdn"],
"enum": ["releaseNotes", "cdn", "fbc", "sign"],
"description": "List of systems that are supported to be required in the data"
}
},
Expand Down Expand Up @@ -520,9 +520,7 @@
}
},
"then": {
"required": [
"releaseNotes"
],
"required": ["releaseNotes"],
"properties": {
"releaseNotes": {
"required": [
Expand All @@ -540,9 +538,7 @@
],
"properties": {
"content": {
"required": [
"images"
]
"required": ["images"]
}
}
}
Expand All @@ -560,14 +556,66 @@
}
},
"then": {
"required": [
"cdn"
],
"required": ["cdn"],
"properties": {
"cdn": {
"required": ["env"]
}
}
}
},
{
"if": {
"properties": {
"systems": {
"contains": {
"const": "fbc"
}
}
}
},
"then": {
"required": ["fbc"],
"properties": {
"fbc": {
"required": [
"env"
"allowedPackages",
"fromIndex",
"targetIndex",
"publishingCredentials",
"buildTimeoutSeconds",
"issueId",
"preGA",
"productName",
"productVersion"
]
},
"properties": {
"allowedPackages": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
{
"if": {
"properties": {
"systems": {
"contains": {
"const": "sign"
}
}
}
},
"then": {
"required": ["sign"],
"properties": {
"sign": {
"required": ["configMapName"]
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion tasks/check-data-keys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ Currently, `releaseNotes`, and `cdn` are the only supported systems.
|----------|---------------------------------------------------------|----------|---------------|
| dataPath | Path to the JSON string of the merged data to use | No | |
| systems | The systems to check that all data keys are present for | Yes | [] |
| schema | The URl to the schema | Yes | https://github.com/konflux-ci/release-service-catalog/blob/production/schema/dataKeys.json |
| schema | The URl to the schema | Yes | https://github.com/konflux-ci/release-service-catalog/blob/development/schema/dataKeys.json |

## Changes in 1.1.0
* Add `-L` option to curl command to follow redirects for schema download.
* Fixes README.md `schema` parameter description.

## Changes in 1.0.0
* Replacing the check with a schema validator
Expand Down
3 changes: 2 additions & 1 deletion tasks/check-data-keys/check-data-keys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ spec:
exit 1
fi
if ! curl -s --fail-with-body "$(params.schema)" -o /tmp/schema ; then
if ! curl -sL --fail-with-body "$(params.schema)" -o /tmp/schema ; then
echo "Failed to download schema file: $(params.schema)"
exit 1
fi
cat "$(workspaces.data.path)/$(params.dataPath)"
systemsJSON=$(echo "$@" | jq -R 'split(" ")')
Expand Down

0 comments on commit d7ef3c8

Please sign in to comment.