From a4d28b73835f2078adefff1aefab59bc1a5bf43c Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Mon, 10 Feb 2025 09:05:36 +0000 Subject: [PATCH 1/5] CLOUDP-299199: Stop creating a ticket for the new api version release --- .github/workflows/api-versions-reminder.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/api-versions-reminder.yml b/.github/workflows/api-versions-reminder.yml index 197d1ba2c3..63067bedb4 100644 --- a/.github/workflows/api-versions-reminder.yml +++ b/.github/workflows/api-versions-reminder.yml @@ -3,7 +3,7 @@ name: 'Send a Slack Notification for APIs important events' on: workflow_dispatch: # Allow manual triggering schedule: - - cron: '0 9 * * 1-5' # Run once a day at 09:00 UTC between Monday and Friday + - cron: '0 9 * * 1' # Run once a day at 09:00 UTC on Monday jobs: new-api-version-reminder: @@ -25,16 +25,6 @@ jobs: id: check-api-versions run: .github/scripts/upcoming_api_releases.sh - # Create a JIRA ticket for the upcoming API versions only if the there is not already a ticket with the same title - - name: Create JIRA Ticket - id: create-jira-ticket - if: steps.check-api-versions.outputs.api_versions != null - env: - JIRA_API_TOKEN: ${{ secrets.jira_api_token }} - JIRA_TICKET_TITLE: "[API Platform] API Versions (${{steps.check-api-versions.outputs.api_versions}}) are about to be released" - JIRA_TICKET_DESCRIPTION: "The following API Versions are scheduled to be released in the next 3 weeks: ${{steps.check-api-versions.outputs.api_versions}}. Please follow https://wiki.corp.mongodb.com/display/MMS/API+eXperience+Production+Checklist#APIeXperienceProductionChecklist-APIVersionReleasechecks" - run: .github/scripts/create_jira_ticket.sh - # Send Slack notification only if the Jira ticket was created - name: Send Slack Notification if: steps.create-jira-ticket.outputs.jira-ticket-id != null From 108a08de0b787ca6830876cc2f6f6da6af474dfc Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Mon, 10 Feb 2025 09:07:16 +0000 Subject: [PATCH 2/5] Update api-versions-reminder.yml --- .github/workflows/api-versions-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api-versions-reminder.yml b/.github/workflows/api-versions-reminder.yml index 63067bedb4..ad2cdeb1b7 100644 --- a/.github/workflows/api-versions-reminder.yml +++ b/.github/workflows/api-versions-reminder.yml @@ -3,7 +3,7 @@ name: 'Send a Slack Notification for APIs important events' on: workflow_dispatch: # Allow manual triggering schedule: - - cron: '0 9 * * 1' # Run once a day at 09:00 UTC on Monday + - cron: '0 9 * * 1' # at 9:00 UTC on Monday jobs: new-api-version-reminder: From 22e134ef03514d5b64e850dbd6f014dbfa306121 Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Mon, 10 Feb 2025 09:07:43 +0000 Subject: [PATCH 3/5] Update api-versions-reminder.yml --- .github/workflows/api-versions-reminder.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/api-versions-reminder.yml b/.github/workflows/api-versions-reminder.yml index ad2cdeb1b7..9b2a16097a 100644 --- a/.github/workflows/api-versions-reminder.yml +++ b/.github/workflows/api-versions-reminder.yml @@ -27,7 +27,6 @@ jobs: # Send Slack notification only if the Jira ticket was created - name: Send Slack Notification - if: steps.create-jira-ticket.outputs.jira-ticket-id != null env: SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID_APIX_2 }} SLACK_BEARER_TOKEN: ${{ secrets.SLACK_BEARER_TOKEN }} From e66824756eca8943e9cb353e216aeca30a2798b0 Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Mon, 10 Feb 2025 09:09:25 +0000 Subject: [PATCH 4/5] Update api-versions-reminder.yml --- .github/workflows/api-versions-reminder.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/api-versions-reminder.yml b/.github/workflows/api-versions-reminder.yml index 9b2a16097a..d5f6c0e7e0 100644 --- a/.github/workflows/api-versions-reminder.yml +++ b/.github/workflows/api-versions-reminder.yml @@ -27,15 +27,15 @@ jobs: # Send Slack notification only if the Jira ticket was created - name: Send Slack Notification + if: steps.check-api-versions.outputs.api_versions != null env: SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID_APIX_2 }} SLACK_BEARER_TOKEN: ${{ secrets.SLACK_BEARER_TOKEN }} API_VERSIONS: ${{ steps.check-api-versions.outputs.api_versions }} - JIRA_TICKET_ID: ${{ steps.create-jira-ticket.outputs.jira-ticket-id }} run: | message_id=$(curl -X POST -H 'Authorization: Bearer '"${SLACK_BEARER_TOKEN}" \ -H 'Content-type: application/json' \ - --data '{"channel":"'"${SLACK_CHANNEL_ID}"'","text":"The following API Versions are scheduled to be released in the next 3 weeks: '"${API_VERSIONS}"'. Jira Ticket: https://jira.mongodb.org/browse/'"${JIRA_TICKET_ID}"'","parse": "full",}' https://slack.com/api/chat.postMessage | jq '.ts') + --data '{"channel":"'"${SLACK_CHANNEL_ID}"'","text":"The following API Versions are scheduled to be released in the next 3 weeks: '"${API_VERSIONS}"'.","parse": "full",}' https://slack.com/api/chat.postMessage | jq '.ts') echo "message_id=${message_id}" sunset-api-version-reminder: From 851647cfe0b2fcd18e4a894ee0ff3df0cf09f2a2 Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Mon, 10 Feb 2025 11:04:58 +0000 Subject: [PATCH 5/5] CLOUDP-298469 --- .github/scripts/create_jira_ticket.sh | 13 +++++++++++-- .github/workflows/api-versions-reminder.yml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/scripts/create_jira_ticket.sh b/.github/scripts/create_jira_ticket.sh index 1ea87e21bd..09e329cf69 100755 --- a/.github/scripts/create_jira_ticket.sh +++ b/.github/scripts/create_jira_ticket.sh @@ -21,12 +21,15 @@ url_encode() { encoded_jira_ticket_title=$(url_encode "${JIRA_TICKET_TITLE:?}") echo "encoded_jira_ticket_title: ${encoded_jira_ticket_title}" -found_issue=$(curl --request GET \ +found_issue_response=$(curl --request GET \ --url 'https://jira.mongodb.org/rest/api/2/search?jql=project=10984%20AND%20issuetype=12%20AND%20component=35986%20AND%20summary~"'"${encoded_jira_ticket_title:?}"'"' \ --header 'Authorization: Bearer '"${JIRA_API_TOKEN:?}" \ --header 'Accept: application/json' \ - --header 'Content-Type: application/json' | jq .total) + --header 'Content-Type: application/json') +echo "found_issue_response: ${found_issue_response}" + +found_issue=$(echo "${found_issue_response}" | jq .total) echo "found_issue: ${found_issue}" if [ "$found_issue" -ne 0 ]; then echo "There is already a Jira ticket with the title \"${JIRA_TICKET_TITLE:?}\"" @@ -34,6 +37,12 @@ if [ "$found_issue" -ne 0 ]; then exit 0 fi +if [ "${found_issue}" == "null" ]; then + echo "There was an error in retrieving the jira ticket: ${found_issue_response}" + echo "No new Jira ticket will be created." + exit 1 +fi + echo "Creating Jira ticket...." echo "JIRA_TICKET_TITLE: ${JIRA_TICKET_TITLE}" echo "JIRA_TICKET_DESCRIPTION: ${JIRA_TICKET_DESCRIPTION}" diff --git a/.github/workflows/api-versions-reminder.yml b/.github/workflows/api-versions-reminder.yml index d5f6c0e7e0..01b1048cf0 100644 --- a/.github/workflows/api-versions-reminder.yml +++ b/.github/workflows/api-versions-reminder.yml @@ -103,7 +103,7 @@ jobs: if: steps.retrieve-sunset-apis.outputs.hash_code_sunset_apis != null env: JIRA_API_TOKEN: ${{ secrets.jira_api_token }} - JIRA_TICKET_TITLE: "[API Platform] Some APIs are approaching their sunset date in the next 3 months. ID: ${{steps.retrieve-sunset-apis.outputs.hash_code_sunset_apis}}" + JIRA_TICKET_TITLE: "Some APIs are approaching their sunset date in the next 3 months. ID: ${{steps.retrieve-sunset-apis.outputs.hash_code_sunset_apis}}" run: | sunset_apis=$(sed 's/"/\\"/g' sunset_apis.json) JIRA_TICKET_DESCRIPTION="The following APIs will be sunset in the next 3 months. Please follow our [wiki|https://wiki.corp.mongodb.com/display/MMS/API+eXperience+Production+Checklist#APIeXperienceProductionChecklist-APISunsetActionItems]. {noformat}${sunset_apis}{noformat}"