-
Notifications
You must be signed in to change notification settings - Fork 6
deployed-labeler: improve error handling, add GET endpoint #86
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
Conversation
This commit generates user readable error messages when the /deployed endpoint is called without required parameters.
@adrienthebo: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
cannot start job - please talk to whoever's in charge of your Werft installation |
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.
Really nice addition of the GET
endpoint! I can see that helping us a lot when debugging failures 🙂
I've made just a few suggestions about go
plugins/deployed-labeler/main.go
Outdated
var preconditionFailed struct { | ||
Errors []string | ||
} | ||
|
||
preconditionFailed.Errors = make([]string, 0, 1) | ||
preconditionFailed.Errors = append(preconditionFailed.Errors, fmt.Sprintf("team and commit are required parameters. Team: '%v', commit: '%v'", team, commitSHA)) |
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.
What was your goal in creating a new type to store the error?
Could we use standard error libs? Maybe errors would make more sense here
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.
What was your goal in creating a new type to store the error?
The PR mention's per golang/go#5161 serializing an error object to json emits an empty object; this caused deployed-labeler to emit an empty object when erroring. This commit converts all errors to strings before returning to the user to provide more context.
Seems to be serialisation and making sure the errors are returned in the HTTP response. 🤔
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.
Update! New err type is not required. Rolled it back to error
This won't render internal gh
errors i.e when a malformed token is used. We get an empty errors
field which @adrienthebo was trying to fix.
Example
{
"deployedPRs": {
"team": null,
"all": null
},
"errors": [
"non-200 OK status code: 401 Unauthorized body: \"{\\\"message\\\":\\\"Bad credentials\\\",\\\"documentation_url\\\":\\\"https://docs.github.com/graphql\\\"}\""
]
}
@ArthurSens thanks for the detailed review! This PR was the result of a bunch of fairly blind hacking and stumbling around Go's error handling; a lot of decisions were based on "well, it compiles, so good enough!" I'll run through and address your comments and do another round of general cleanup and will follow up with you on another review - likely on Monday since it's Friday night your time, but perhaps tonight if you're burning the weekend oil. 😊 No rush! |
Hi @gitpod-io/engineering-delivery-operations-experience it looks like this is caught in limbo, so I added you all back as a reviewer. |
@kylos101 @adrienthebo This work also might have gotten caught up in the changes in the team structure (i.e. Scout Team). Could this work be handed off? |
Hey @liam-j-bennett 👋 we discussed with @meysholdt and @corneliusludmann during the platform/self-hosted to devx/delivery transformation, and my understanding is that Delivery Team owns the labeling component. Is it in the list of Delivery owned components? Perhaps something changed since then? cc: @corneliusludmann |
No, nothing has changed. I think @liam-j-bennett's comment was about Adrien being busy with scout team work and not in the position to continue this and should be handed over to someone else from the delivery team. I removed Adrien from the corresponding issue https://github.com/gitpod-io/ops/issues/6409 and put it back to “Scheduled” so that someone else can pick this up soon. |
Now that the PR compiles, Testing this PR now. 👀 |
2192857
to
41521d1
Compare
41521d1
to
be466da
Compare
Update, Now that the changes work: The move from
|
be466da
to
5a51b9a
Compare
per golang/go#5161 serializing an `error` object to json emits an empty object; this caused deployed-labeler to emit an empty object when erroring. This commit converts all errors to strings before returning to the user to provide more context. Signed-off-by: Tarun Pothulapati <[email protected]>
Signed-off-by: Tarun Pothulapati <[email protected]>
5a51b9a
to
11b2df5
Compare
PR is now ready to review! Cleaned up commit messages by rebasing things. 👍🏼 |
@ArthurSens Just to confirm before proceeding, The deployment process is manual as per thereadme doc right? :) |
It has been a long time since I did anything here, but I believe it still the same process 😅 |
Description
deployed-labeler: bump commit limit to 5 pages, 100 results
deployed-labeler: emit error messages from /deployed endpoint
This commit generates user readable error messages when the /deployed endpoint is called without required parameters.
deployed-labeler: expose log level CLI option, adjust log levels
deployed-labeler: add GET handler for deployed to indicate label status
deployed-labeler: serialise errors as strings
per golang/go#5161 serializing an
error
object to json emits an empty object; this caused deployed-labeler to emit an empty object when erroring. This commit converts all errors to strings before returning to the user to provide more context.Related Issue(s)
How to test
Test error handling
curl "http://localhost:8080/deployed?commit=470062367333b5d9992188dbc9ff89465c0ab1e3&team=workspace"
Test status endpoint
curl "http://localhost:8080/deployed?commit=470062367333b5d9992188dbc9ff89465c0ab1e3&team=workspace"
Release Notes
Documentation