-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RELEASE-1403): rework embargo-check task for issues
This commit reworks the managed embargo-check task for how it handles issues in issues.redhat.com. First, it adds authentication for searching for these issues. If the issue is found and is not of type Vulnerability, it will pass. If the issue is of type Vulnerability, the task will now ensure that the component from the issue matches a component in the releaseNotes.content.images section and that the CVE from the issue is present in said component section. Signed-off-by: Johnny Bieren <[email protected]>
- Loading branch information
1 parent
26c0979
commit f11dc89
Showing
10 changed files
with
487 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
tasks/managed/embargo-check/tests/test-embargo-check-non-vuln-rh-issue.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: test-embargo-check-non-vuln-rh-issue | ||
spec: | ||
description: Test for embargo-check with a issues.redhat.com issue that is not of type Vulnerability | ||
workspaces: | ||
- name: tests-workspace | ||
tasks: | ||
- name: setup | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
taskSpec: | ||
workspaces: | ||
- name: data | ||
steps: | ||
- name: setup-values | ||
image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 | ||
script: | | ||
#!/usr/bin/env sh | ||
set -eux | ||
cat > "$(workspaces.data.path)"/data.json << EOF | ||
{ | ||
"releaseNotes": { | ||
"issues": { | ||
"fixed": [ | ||
{ | ||
"id": "ISSUE-123", | ||
"source": "jira.atlassian.com" | ||
}, | ||
{ | ||
"id": "FEATURE-123", | ||
"source": "issues.redhat.com" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
EOF | ||
- name: run-task | ||
taskRef: | ||
name: embargo-check | ||
params: | ||
- name: dataPath | ||
value: data.json | ||
- name: pipelineRunUid | ||
value: $(context.pipelineRun.uid) | ||
- name: taskGitUrl | ||
value: "http://localhost" | ||
- name: taskGitRevision | ||
value: "main" | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
runAfter: | ||
- setup | ||
- name: check-result | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
taskSpec: | ||
steps: | ||
- name: check-result | ||
image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 | ||
script: | | ||
#!/usr/bin/env bash | ||
set -eux | ||
if [ "$(wc -l < "$(workspaces.data.path)"/mock_curl.txt)" != 3 ]; then | ||
echo Error: curl was expected to be called 3 times. Actual calls: | ||
cat "$(workspaces.data.path)"/mock_curl.txt | ||
exit 1 | ||
fi | ||
[[ $(head -n 1 "$(workspaces.data.path)/mock_curl.txt") == *"issues.redhat.com/rest/api/2/field" ]] | ||
[[ $(head -n 2 "$(workspaces.data.path)/mock_curl.txt" | tail -n 1) \ | ||
== *"ISSUE-123"* ]] | ||
[[ $(tail -n 1 "$(workspaces.data.path)/mock_curl.txt") == *"FEATURE-123"* ]] | ||
runAfter: | ||
- run-task |
61 changes: 61 additions & 0 deletions
61
tasks/managed/embargo-check/tests/test-embargo-check-nonexistent-rh-issue.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: test-embargo-check-nonexistent-rh-issue | ||
annotations: | ||
test/assert-task-failure: "run-task" | ||
spec: | ||
description: Test for embargo-check where a issues.redhat.com issue cannot be found | ||
workspaces: | ||
- name: tests-workspace | ||
tasks: | ||
- name: setup | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
taskSpec: | ||
workspaces: | ||
- name: data | ||
steps: | ||
- name: setup-values | ||
image: quay.io/konflux-ci/release-service-utils:0f82be4be43294b6a96846d87ef7f7c0b9e34267 | ||
script: | | ||
#!/usr/bin/env sh | ||
set -eux | ||
cat > "$(workspaces.data.path)/data.json" << EOF | ||
{ | ||
"releaseNotes": { | ||
"issues": { | ||
"fixed": [ | ||
{ | ||
"id": "MISSINGRH-123", | ||
"source": "issues.redhat.com" | ||
}, | ||
{ | ||
"id": "12345", | ||
"source": "bugzilla.redhat.com" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
EOF | ||
- name: run-task | ||
taskRef: | ||
name: embargo-check | ||
params: | ||
- name: dataPath | ||
value: data.json | ||
- name: pipelineRunUid | ||
value: $(context.pipelineRun.uid) | ||
- name: taskGitUrl | ||
value: "http://localhost" | ||
- name: taskGitRevision | ||
value: "main" | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
runAfter: | ||
- setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.