-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RELEASE-1244): make create-github-release task idempotent (#666)
Signed-off-by: Jing Qi <jinqi@redhat.com>
- Loading branch information
Showing
5 changed files
with
106 additions
and
10 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
74 changes: 74 additions & 0 deletions
74
tasks/create-github-release/tests/test-create-github-exist-release.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,74 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: test-create-github-exist-release | ||
spec: | ||
description: | | ||
Run the create-github-release task to create an existing release. | ||
It will not be recreated. | ||
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:e633d51cd41d73e4b3310face21bb980af7a662f | ||
script: | | ||
#!/usr/bin/env sh | ||
set -eux | ||
mkdir $(workspaces.data.path)/results | ||
mkdir $(workspaces.data.path)/release/ | ||
cat > $(workspaces.data.path)/release/foo.json << EOF | ||
{ "example github release file": "just mock data" } | ||
EOF | ||
touch $(workspaces.data.path)/release/foo.zip | ||
touch $(workspaces.data.path)/release/foo_SHA256SUMS | ||
touch $(workspaces.data.path)/release/foo_SHA256SUMS.sig | ||
- name: run-task | ||
taskRef: | ||
name: create-github-release | ||
params: | ||
- name: githubSecret | ||
value: test-create-github-release-token | ||
- name: repository | ||
value: foo/repo_with_release | ||
- name: release_version | ||
value: 1.2.3 | ||
- name: content_directory | ||
value: release/ | ||
- name: resultsDirPath | ||
value: "results" | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
runAfter: | ||
- setup | ||
- name: check-result | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
taskSpec: | ||
workspaces: | ||
- name: data | ||
steps: | ||
- name: check-result | ||
image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f | ||
script: | | ||
#!/usr/bin/env bash | ||
set -eux | ||
if [ "$(wc -l < "$(workspaces.data.path)"/mock_gh.txt)" != 1 ]; then | ||
echo Error: gh was expected to be called 1 times. Actual calls: | ||
cat "$(workspaces.data.path)"/mock_gh.txt | ||
exit 1 | ||
fi | ||
runAfter: | ||
- run-task |
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