Skip to content

Commit

Permalink
WIP test values
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasferrandiz committed Dec 3, 2024
1 parent 2657c89 commit a4814dc
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 64 deletions.
33 changes: 19 additions & 14 deletions updatecli/scripts/create-issue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@
TARGET_REPOSITORY="rancher/rke2"
BODY="Url of the failed run: ${UPDATECLI_GITHUB_WORKFLOW_URL}"

create-issue() {
title=$1
report-error() {
exit_code=$?
trap - EXIT INT

#check if issue already exists
issues=$(gh issue list -R ${TARGET_REPOSITORY} \
--search "is:open ${title}" \
--app rke2-issues-updatecli --json number --jq ".[].number" | wc -l)
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 "${title}" \
--body "${BODY}"
else
echo "Issue already exists for: ${title}"
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 create-issue
export -f report-error
11 changes: 1 addition & 10 deletions updatecli/scripts/update-calico.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ set -eu

source $(dirname $0)/create-issue.sh

report-error() {
exit_code=$?
trap - EXIT INT

if [[ $exit_code != 0 ]]; then
create-issue "Updatecli failed for calico ${CALICO_VERSION}"
fi

exit ${exit_code}
}
ISSUE_TITLE="Updatecli failed for calico ${CALICO_VERSION}"
trap report-error EXIT INT

if [ -n "$CALICO_VERSION" ]; then
Expand Down
11 changes: 1 addition & 10 deletions updatecli/scripts/update-canal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ set -eu

source $(dirname $0)/create-issue.sh

report-error() {
exit_code=$?
trap - EXIT INT

if [[ $exit_code != 0 ]]; then
create-issue "Updatecli failed for canal with calico ${CALICO_VERSION} and flannel ${FLANNEL_VERSION}"
fi

exit ${exit_code}
}
ISSUE_TITLE="Updatecli failed for canal ${CALICO_VERSION} / ${FLANNEL_VERSION}"
trap report-error EXIT INT

if [ -n "$FLANNEL_VERSION" ]; then
Expand Down
11 changes: 1 addition & 10 deletions updatecli/scripts/update-cilium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ set -eu

source $(dirname $0)/create-issue.sh

report-error() {
exit_code=$?
trap - EXIT INT

if [[ $exit_code != 0 ]]; then
create-issue "Updatecli failed for cilium ${CILIUM_VERSION}"
fi

exit ${exit_code}
}
ISSUE_TITLE="Updatecli failed for cilium ${CILIUM_VERSION}"
trap report-error EXIT INT

if [ -n "$CILIUM_VERSION" ]; then
Expand Down
11 changes: 1 addition & 10 deletions updatecli/scripts/update-flannel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ set -eu

source $(dirname $0)/create-issue.sh

report-error() {
exit_code=$?
trap - EXIT INT

if [[ $exit_code != 0 ]]; then
create-issue "Updatecli failed for flannel ${FLANNEL_VERSION}"
fi

exit ${exit_code}
}
ISSUE_TITLE="Updatecli failed for flannel ${FLANNEL_VERSION}"
trap report-error EXIT INT

if [ -n "$FLANNEL_VERSION" ]; then
Expand Down
11 changes: 1 addition & 10 deletions updatecli/scripts/update-multus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ set -eux

source $(dirname $0)/create-issue.sh

report-error() {
exit_code=$?
trap - EXIT INT

if [[ $exit_code != 0 ]]; then
create-issue "Updatecli failed for multus ${MULTUS_VERSION}"
fi

exit ${exit_code}
}
ISSUE_TITLE="Updatecli failed for multus ${MULTUS_VERSION}"
trap report-error EXIT INT

if [ -n "$MULTUS_VERSION" ]; then
Expand Down

0 comments on commit a4814dc

Please sign in to comment.