Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

[$200] Notification of expired tokens #444

Closed
jmgasper opened this issue May 18, 2022 · 10 comments
Closed

[$200] Notification of expired tokens #444

jmgasper opened this issue May 18, 2022 · 10 comments

Comments

@jmgasper
Copy link
Collaborator

jmgasper commented May 18, 2022

When Github / Gitlab tokens expire, it can cause problems with processing tickets. We should figure out a way to notify copilots when tokens expire.

I think the best approach would be to handle this in the processor:

  1. If an event is raised that the processor should handle (opened ticket, assigned, closed for payment, etc...), but the processor can't handle it because of an expired token
  2. Use the Topcoder messaging Kafka queue to send an email to the copilot of the project alerting them that an event failed. Something like:

Hi handle,
You made an update to ticket link to ticket, but Topcoder-X couldn't process it properly because your Gitlab or Github token has expired. To fix this, please login to x.topcoder.com, click your handle in the upper right and then "Settings" to refresh your token. You will need to redo the action that failed in Gitlab or Github.

@jmgasper jmgasper changed the title Notification of expired tokens [$150] Notification of expired tokens May 20, 2022
@jmgasper
Copy link
Collaborator Author

Challenge https://www.topcoder.com/challenges/f9ab926f-5aa8-4624-a27b-cbc842fd2370 has been created for this ticket.

This is an automated message for ghostar via Topcoder X

@jmgasper jmgasper changed the title [$150] Notification of expired tokens [$200] Notification of expired tokens May 23, 2022
@jmgasper
Copy link
Collaborator Author

@afrisalyp - Any interest in this one?

@jmgasper
Copy link
Collaborator Author

Challenge https://www.topcoder.com/challenges/f9ab926f-5aa8-4624-a27b-cbc842fd2370 has been assigned to afrisalyp.

This is an automated message for ghostar via Topcoder X

@afrisalyp
Copy link
Collaborator

@jmgasper

Where we can find the detail of Topcoder messaging Kafka queue?

@jmgasper
Copy link
Collaborator Author

jmgasper commented May 23, 2022

@afrisalyp - That would help 😆

So, we'll be adding records to the notifications.action.create Kafka queue on Topcoder's system, similar to what we already use now for handling the Topcoder-X events from the receiver that are handled by the processor

You can view these in lauscher - https://lauscher.topcoder-dev.com, and login with jcori.

A sample is below.

The following fields should be configurable in Topcoder-X as new values:

  • type
  • sendgridTemplateId
  • subject

And the data can be whatever we need. The data field is used to fill in the sendgridTemplateId, which I haven't defined yet, so we'll fill in the data first and then I'll get a template created for testing.

{
  "notifications": [
    {
      "serviceId": "email",
      "type": "taas.notification.candidates-available-for-review",
      "details": {
        "from": "[email protected]",
        "recipients": [
          {
            "userId": 88778394
          }
        ],
        "cc": [],
        "data": {
          "teamName": "test55",
          "teamJobs": [
            {
              "title": "job 575",
              "nResourceBookings": 0,
              "jobCandidates": [
                {
                  "handle": "taasintake1000",
                  "status": "open"
                }
              ],
              "reviewLink": "https://platform.topcoder-dev.com/taas/myteams/18989/positions/b046a463-b0b1-4715-9834-3fc80db0c569/candidates/to-review",
              "jobUrl": "https://platform.topcoder-dev.com/taas/myteams/18989/positions/b046a463-b0b1-4715-9834-3fc80db0c569"
            },
            {
              "title": "MS calender",
              "nResourceBookings": 0,
              "jobCandidates": [
                {
                  "handle": "taasintake1000",
                  "status": "open"
                }
              ],
              "reviewLink": "https://platform.topcoder-dev.com/taas/myteams/18989/positions/59d23b84-8d02-4f23-bfcc-5ac1052ac0b6/candidates/to-review",
              "jobUrl": "https://platform.topcoder-dev.com/taas/myteams/18989/positions/59d23b84-8d02-4f23-bfcc-5ac1052ac0b6"
            }
          ],
          "subject": "You have candidates to review",
          "body": ""
        },
        "sendgridTemplateId": "d-97e4aae73cce4917b0c0f4e78929d1d4",
        "version": "v3"
      }
    }
  ]
}

@afrisalyp
Copy link
Collaborator

@jmgasper

I still faced deployment error on Mac M1.
I restored my old Ubuntu PC to run this service. 😃

Things I need to clarify:

  1. It will use the same kafka server, so the endpoint and configs would be the same. We just need to send it to another Topic. Is it correct?
  2. Currently, how long does Github/Gitlab token expire in Topcoder X?

@jmgasper
Copy link
Collaborator Author

  1. Yes, that's correct
  2. That's a new problem we're having with Gitlab. I think the Github expiration is quite long. Gitlab used to not expire for months, but they've changed that recently to two hours and we're working through that on a separate ticket

@afrisalyp
Copy link
Collaborator

@jmgasper

I've raised a pull request. Please review it.
It tested in my local kafka.

Please let me know once the data is ready.

@afrisalyp
Copy link
Collaborator

@jmgasper
Copy link
Collaborator Author

Payment task has been updated: https://www.topcoder.com/challenges/f9ab926f-5aa8-4624-a27b-cbc842fd2370
Payments Complete
Winner: afrisalyp
Challenge f9ab926f-5aa8-4624-a27b-cbc842fd2370 has been paid and closed.

This is an automated message for ghostar via Topcoder X

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants