Code4GovTech / C4GT

C4GT aims to build active open-source community around DPGs for sustainable DPI implementations
https://codeforgovtech.in/
MIT License
281 stars 342 forks source link

[Bug] Incorrect role assignment #432

Closed MohitNSamagra closed 2 weeks ago

MohitNSamagra commented 1 month ago

Problem: Roles on discord are not being assigned by our bot Cause: Deployment process is complex - Jenkis build with unsealing of vault. Unsealing the vault is unknown as of now.

MohitNSamagra commented 1 month ago
MohitNSamagra commented 1 month ago

@jaanbaaz to check with Kanav

MohitNSamagra commented 1 month ago

@jaanbaaz to debug with @KDwevedi

KDwevedi commented 1 month ago

RCA

To deploy the discord bot, this action is run on commits to main on the discord bot repo to build and push the docker image to ghcr.

When jenkins deploy is triggered, it pulls this image and deploys it as a docker container.

Unfortunately, the build-and-push action workflow was failing because it was running the workflow file from dev branch which was broken.

If the image doesn't build, the image in the container repository doesn't update, therefore changes to the code don't get deployed. Jenkins was working fine, it just wasn't deploying the updated image.

The Fix

We pushed a hotfix to the .github/workflows configuration file on the repo on the main branch that allows us to trigger a image build for the main branch manually and selectively.

This ran successfully and updated the docker image, which in turn allows new prod changes to be deployed.

MohitNSamagra commented 1 month ago
MohitNSamagra commented 1 month ago
MohitNSamagra commented 1 month ago
MohitNSamagra commented 1 month ago
MohitNSamagra commented 1 month ago
karntrehan commented 3 weeks ago

Deployment undertaken. Bot not updated. Bot has been blocked by discord due to auto-spam id. Discord support has not come back. Need to figure a different approach.

Image

karntrehan commented 3 weeks ago

Quarantine was not the issue. We had to run a db change on prod. It has been done now.

Flow:

  1. User joins server
  2. User accepts terms and conditions
  3. User reaches #authorize channel
  4. User clicks Register and fills the form
  5. We update user's details in db (contributors_discord)
  6. We check if user is already a verified contributor. If they are, flow ends here, else continues.
  7. We should user a flow to authenticate via github
  8. As soon as user clicks the button we start a loop to check if user has authenticated every 15 seconds. This is by checking contributors_registration table for user's discord id.
  9. As soon as an entry is found, user is given verified contributor role.
  10. This loop waits for 5 mins and times out. Else a task runs every 60 mins to give all members of contributors_registration a verified contributor role.