Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1065] Fixed failing GitHub notifications. #1361

Merged
merged 1 commit into from
Aug 17, 2024

Conversation

AlexSkrypnyk
Copy link
Member

@AlexSkrypnyk AlexSkrypnyk commented Aug 17, 2024

Closes #1065

The root cause was related to the fact that a Git ref was used instead of a branch name for PRs.

From https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28

ref string
The name of the ref. This can be a branch, tag, or SHA.

The script was using DREVOPS_NOTIFY_REF instead of DREVOPS_NOTIFY_BRANCH for PRs. This PR fixes that.

It also adds 2 more changes:

  1. More verbose messages on failures + tests.
  2. Failed notifications are now NOT blocking deployments. This is to allow to deploy into hosting without waiting for the CI to pass (setting the deployment environment status for the PR without all checks passed will fail).
    With the now additionally expanded messages, this should provide enough information

@github-actions github-actions bot temporarily deployed to commit August 17, 2024 01:31 Inactive
Copy link

codecov bot commented Aug 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.

Project coverage is 3.18%. Comparing base (c7f74a7) to head (e85a3a8).
Report is 2 commits behind head on develop.

Files Patch % Lines
scripts/drevops/notify-github.sh 0.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #1361      +/-   ##
==========================================
- Coverage     3.19%   3.18%   -0.01%     
==========================================
  Files           41      41              
  Lines         3038    3046       +8     
==========================================
  Hits            97      97              
- Misses        2941    2949       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -92,10 +92,11 @@ tasks:
DREVOPS_NOTIFY_EVENT=post_deployment \
DREVOPS_NOTIFY_PROJECT=$LAGOON_PROJECT \
DREVOPS_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \
./scripts/drevops/notify.sh
./scripts/drevops/notify.sh || true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not fail the deployment if the notifications fail

@@ -118,7 +118,7 @@ load _helper.bash
declare -a STEPS=(
"Started dispatching notifications."
"Started GitHub notification for pre_deployment event."
"@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {\"ref\":\"mybranch\", \"environment\": \"PR\", \"auto_merge\": false} # {\"id\": \"${app_id}\", \"othervar\": \"54321\"}"
"@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {\"ref\":\"existingbranch\", \"environment\": \"PR\", \"auto_merge\": false} # {\"id\": \"${app_id}\", \"othervar\": \"54321\"}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replacing to use existingbranch and nonexistingbranch

@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (rebase) August 17, 2024 01:47
@AlexSkrypnyk AlexSkrypnyk added this to the 1.23 milestone Aug 17, 2024
@AlexSkrypnyk AlexSkrypnyk added the PR: AUTOMERGE Pull request has been approved and set to automerge label Aug 17, 2024
@AlexSkrypnyk AlexSkrypnyk merged commit 285373e into develop Aug 17, 2024
20 of 21 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/fix-github-notifications branch August 17, 2024 01:53
@AlexSkrypnyk
Copy link
Member Author

Enabled_GitHub_deployment_notifications__by_AlexSkrypnyk_·_Pull_Request__3_·_drevops_website

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: AUTOMERGE Pull request has been approved and set to automerge
Projects
Status: Released in 24.8.0
Development

Successfully merging this pull request may close these issues.

Github deployment notifications failing
1 participant