Serverless based Lambda function for Labelling PRs based on CI & PR Review status #27
Serverless based Lambda function for Labelling PRs based on CI & PR Review status #27
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure about the objective of this, but I see quite a few issues:
- you don't need to query Jenkins at all, GitHub has all the information
- once a PR went into a successful status, the label will not be redacted
- you should rather use an event driven approach where you subscribe to the GitHub webhook Event which is fired every single time a commit is made or check has been updated. Then have a label like "ci-passed", "unstable" and "ci-unsuccesful".
Right now I think that this implementation will cause rather more confusion.
maybe we could automate the PR labeling as the following pseudo code describes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally going in a great direction!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the approach to test should be reengineered. At the moment, this does not seem like a proper test procedure since things are not mocked out and neither are the results verified.
Not valid review comments. |
What do you mean with "not valid review comments", Sandeep? |
I just meant - My comment is not a technical review comment on the PR. This is just a thank you note :) |
To run all the tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remember to add apache header to all files.
This reverts commit 24fb126.
…te doesnt capture it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your work!
Purpose
An automated way of labeling PRs based on CI status & PR Review state.
This serves dual purpose
Testing
Tested it locally & on dev account.
Deployed this on Prod account.
Reproduce
Once you put the redacted code & have AWSCLI + Serverless configured
Should work for deploying this lambda function on the account [dev/prod stage based on choice].
** Note **
Secrets have been redacted.
Approach
Details
Github Webhook -> Lambda 1 -> SQS -> Lambda 2
Github Webhook sends Status Events & triggers the lambda function "pr-status-labeler"
Lambda 2 in turn leverages Github API to add labels to PR [based on the following logic]
Old Approach [Use Jenkins API + GithubAPI]DetailsRuns once per day. Configured in theserverless.yml
script.It reuses credentials set during MXNet Bot [Jenkins & Github credentials].
ResultsResults in the successful run on Prod for apache/incubator-mxnet repoLambda function labeled 18 PRs that had passed all the test. Detailed logs in the Cloudwatch Log Group [corresponding to the Lambda function] in the Prod CI AWS account]