From 1c0b8df08df7f430d81b24924f3f77669a9c99ee Mon Sep 17 00:00:00 2001 From: Sean Conroy Date: Tue, 3 Dec 2024 13:11:26 +0000 Subject: [PATCH] feat(RELEASE-400): incorporate check-data-keys task in FBC pipeline This commit adds the check-data-keys task into the FBC pipeline to ensure validation of required data keys. Signed-off-by: Sean Conroy --- pipelines/fbc-release/README.md | 3 ++ pipelines/fbc-release/fbc-release.yaml | 26 +++++++++- schema/dataKeys.json | 70 ++++++++++++++++++++++---- 3 files changed, 87 insertions(+), 12 deletions(-) diff --git a/pipelines/fbc-release/README.md b/pipelines/fbc-release/README.md index 466547d92..d3ca91161 100644 --- a/pipelines/fbc-release/README.md +++ b/pipelines/fbc-release/README.md @@ -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. diff --git a/pipelines/fbc-release/fbc-release.yaml b/pipelines/fbc-release/fbc-release.yaml index 31363e8e6..e302bb978 100644 --- a/pipelines/fbc-release/fbc-release.yaml +++ b/pipelines/fbc-release/fbc-release.yaml @@ -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 @@ -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" diff --git a/schema/dataKeys.json b/schema/dataKeys.json index 892585352..6b2c69e44 100644 --- a/schema/dataKeys.json +++ b/schema/dataKeys.json @@ -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" } }, @@ -520,9 +520,7 @@ } }, "then": { - "required": [ - "releaseNotes" - ], + "required": ["releaseNotes"], "properties": { "releaseNotes": { "required": [ @@ -540,9 +538,7 @@ ], "properties": { "content": { - "required": [ - "images" - ] + "required": ["images"] } } } @@ -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"] } } }