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

feat: Implement GitHub Webhook #3906

Merged
merged 5 commits into from
May 9, 2024
Merged

Conversation

novakzaballa
Copy link
Contributor

@novakzaballa novakzaballa commented May 9, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Implement GitHub Webhook to receive events from GitHub App.
Initially we only handle the Integration Delete action. We delete the configuration and any related object in the DB when an installation is removed from GitHub.

Also, the env var GITHUB_WEBHOOK_SECRET was added to ECS task definition web secrets. This env var is not used by the tasks executed by the task processor. It is only used by the GitHub webhook.

Once we generate the GITHUB_WEBHOOK_SECRET we need to update our GitHub App to use it as shown here
image

https://github.com/organizations/Flagsmith/settings/apps/flagsmith

How did you test this code?

Unit tests added.

Copy link

vercel bot commented May 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2024 6:09am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2024 6:09am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2024 6:09am

Copy link
Contributor

github-actions bot commented May 9, 2024

Uffizzi Preview deployment-51478 was deleted.

Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 93.90244% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 95.93%. Comparing base (0c79870) to head (33f3bf5).

Files Patch % Lines
api/integrations/github/views.py 80.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3906   +/-   ##
=======================================
  Coverage   95.92%   95.93%           
=======================================
  Files        1134     1135    +1     
  Lines       35956    36028   +72     
=======================================
+ Hits        34492    34564   +72     
  Misses       1464     1464           

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

api/integrations/github/views.py Outdated Show resolved Hide resolved
api/integrations/github/views.py Outdated Show resolved Hide resolved
api/integrations/github/views.py Outdated Show resolved Hide resolved
@@ -245,6 +245,10 @@
"name": "SSE_AUTHENTICATION_TOKEN",
"valueFrom": "arn:aws:secretsmanager:eu-west-2:084060095745:secret:ECS-API-LxUiIQ:SSE_AUTHENTICATION_TOKEN::"
},
{
Copy link
Member

Choose a reason for hiding this comment

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

Have we added these secrete?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not yet, I don't have the credentials or authorization to do it. Could you?

Copy link
Member

Choose a reason for hiding this comment

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

Have we added it to staging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added instructions in the description on how to update the GitHub App once we have a secret defined and set.

Copy link
Member

Choose a reason for hiding this comment

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

But we can't merge it without it, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For another env var added @matthewelwell asked me to do first the PR declaring the env var in the infrastructure folder. And he set the value after that, however, I would say that he has the last word.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that makes sense, but we still can't merge it before the secrets are added because the deployment will fail

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@matthewelwell have set the env var secret.

@novakzaballa novakzaballa added this pull request to the merge queue May 9, 2024
Merged via the queue into main with commit 9303267 May 9, 2024
23 of 24 checks passed
@novakzaballa novakzaballa deleted the feat/implement-github-webhook branch May 9, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants