-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updatecli: create an issue in rancher/rke2 when an updatecli run fails.
The script uses a Github App to authenticate to the rke2 repo. It also checks whether the issue already exists before creating it.
- Loading branch information
1 parent
50fc373
commit 6db484f
Showing
12 changed files
with
85 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
TARGET_REPOSITORY="rancher/rke2" | ||
BODY="Url of the failed run: ${UPDATECLI_GITHUB_WORKFLOW_URL}" | ||
|
||
report-error() { | ||
exit_code=$? | ||
trap - EXIT INT | ||
|
||
if [[ $exit_code != 0 ]]; then | ||
#check if issue already exists | ||
issues=$(gh issue list -R ${TARGET_REPOSITORY} \ | ||
--search "is:open ${ISSUE_TITLE}" \ | ||
--app rke2-issues-updatecli --json number --jq ".[].number" | wc -l) | ||
|
||
if [[ $issues = 0 ]]; then | ||
echo "Creating issue for: $title" | ||
gh issue create -R ${TARGET_REPOSITORY} \ | ||
--title "${ISSUE_TITLE}" \ | ||
--body "${BODY}" | ||
else | ||
echo "Issue already exists for: ${ISSUE_TITLE}" | ||
fi | ||
fi | ||
|
||
exit $exit_code | ||
} | ||
|
||
export -f report-error |
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
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
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