Repository navigation
feat(jira): read a ticket and its comments from Jira Cloud - #42
Merged
Merged
Conversation
internal/jira's Client reads a ticket, with the fields that baton shows, and all its comments, oldest first, through Atlassian's gateway with the user's email and scoped token. It reads the site's cloud ID from the site's tenant_info without a login, so that the token goes to the gateway alone. It checks the key and the cloud ID, reads at most 16 MiB of an answer, and gives Jira's messages when Jira refuses (decision 59, fact 41).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Step
jira-client(plan row 65), the second of the three Jira steps (decision 58):internal/jira/client.go:Client{HTTP, Site, Email, Token}andTicket(ctx, key):https://<site>/_edge/tenant_infowithout a login, takes it only as a UUID, in its usual form;api.atlassian.com/ex/jira/<cloudId>/rest/api/3/...alone, asking for the fields that baton shows (summary,issuetype,status,parent,description,subtasks,issuelinks);orderBy=created, a page at a time, until it hastotalor a page comes empty;errorMessagesor the gateway'smessage, or the status alone when the answer isn't JSON.httptestTLS server, a transport that sends each host to it, routes by host): DEMO-1 and DEMO-6 through to their Markdown goldens, page counts, an overstated total, the 16 MiB edge both ways, bad keys with no request sent, a wrong token, a missing ticket, a proxy's page, refused comments, a bad cloud ID, offline, a bad site, a cancelled context.jira-textDone (feat(jira): show a ticket as Markdown #41) andjira-clientIn review (feat(jira): read a ticket and its comments from Jira Cloud #42), the design's Jira paragraph and Sources.Checks
mise run checkgreen;internal/jiracoverage 100%, total 99.4%.client.go, all caught (two rewritten after they didn't build).demo-1read DEMO-1 in 4 requests (tenant, ticket, 2 comment pages), and the errors read asread DEMO-99: 404 Not Found: Issue does not exist or you do not have permission to see it.,read DEMO-1: 401 Unauthorized: Unauthorized,read the cloud ID of example.atlassian.net: 503 Service Unavailable.Not checked yet
No real Jira call: whether
tenant_infoanswers without a login and the gateway's 401 body shape wait for a live check, which the user asked to be asked about again when thejirastep's code is ready.Next:
jira(config section, the Keychain read,baton jira <KEY>).