Draft
Conversation
Migrate from andygrunwald/go-jira to ctreminiom/go-atlassian v2.3.0 to support Jira Cloud instances that require the new /rest/api/3/search/jql endpoint. The old /rest/api/[2|3]/search endpoints were deprecated and removed from Jira Cloud (effective May 1, 2025). Key changes: - Replace go-jira with go-atlassian v2.3.0 - Use SearchJQL() method for new /search/jql endpoint - Support Basic Auth with email + API token (required for Jira Cloud) - Use Atlassian Document Format (ADF) for issue descriptions and comments - Request summary field explicitly in search to fix nil field issue Fixes issue search and comment creation for Jira Cloud instances. Related: ctreminiom/go-atlassian#345 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Jira Cloud no longer supports Wiki Markup formatting and requires Atlassian Document Format (ADF) for issue descriptions and comments. Changes: - Remove Wiki Markup template (desc constant) - Implement buildADFDescription() to generate proper ADF structure - Use ADF for both issue creation and comment creation - Add proper ADF node types: heading, codeBlock, table, paragraph - Fix empty field handling: use space for empty BUILD TAG and ORCHESTRATOR to ensure text nodes always have the required 'text' field - Update description() return type from string to *models.CommentNodeScheme - Update newIssue() to accept ADF description directly The ADF structure includes: - H3 headings for each section (Message, STDERR, STDOUT, ERROR) - Code blocks with language="text" for test output - Table with bold headers for Build Information - Proper text nodes with marks for links and formatting This fixes the "INVALID_INPUT" error that occurred when creating comments with empty table cells, which was caused by text nodes missing the required 'text' field. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix test compilation errors after migrating from go-jira to go-atlassian: - Update imports from github.com/andygrunwald/go-jira to go-atlassian models - Replace jira.Issue with models.IssueScheme - Replace jira.IssueFields with models.IssueFieldsScheme - Update TestDescription to verify ADF structure instead of Wiki Markup - Verify ADF node types, headings, code blocks, and tables - Test truncation functionality with ADF format All tests now pass successfully. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.
Overview
This PR updates junit2jira to work with Jira Cloud by migrating from the deprecated Jira API v2 to v3, switching from
andygrunwald/go-jiratoctreminiom/go-atlassian/v2, and converting all templates from Wiki Markup to Atlassian Document Format (ADF).Problems Encountered and Solutions
1. Authentication Failure (403 Forbidden)
Problem: Initial implementation used PAT (Personal Access Token) authentication with
jira.PATAuthTransport, which failed with:Root Cause: Jira Cloud does not support PAT authentication in the same way as Jira Server/Data Center. Jira Cloud requires Basic Auth using email + API token.
Solution: Changed authentication to Basic Auth:
2. API v2 Endpoint Deprecation (410 Gone)
Problem: After fixing authentication, all search requests failed with:
Root Cause: Jira Cloud deprecated the
/rest/api/2/searchendpoint. The error message explicitly instructed migration to/rest/api/3/search/jql.Investigation: Searched the
andygrunwald/go-jirarepository and found:Solution: Migrated from
andygrunwald/go-jiratoctreminiom/go-atlassian/v2v2.3.0, which has native support for Jira API v3 and the newSearchJQLendpoint.3. Library Migration Challenges
Problem: The
go-atlassianlibrary has a completely different API structure compared togo-jira.Changes Required:
github.com/ctreminiom/go-atlassian/v2/jira/v3Issue.Search.Post()withIssue.Search.SearchJQL()startAttonextPageTokencontext.TODO()to all API callsjira.Issuetomodels.IssueScheme4. Search Results with Nil Fields
Problem: After migration, search returned issues but all had
<nil fields>:Root Cause: The v3 API requires explicitly requesting which fields to return. Passing
nilfor the fields parameter returns minimal data without the fields we need for matching.Solution: Changed the SearchJQL call to explicitly request the summary field:
5. Wiki Markup No Longer Supported
Problem: After successful migration to v3 API, the tool worked for creating issues and comments, but formatting was wrong. Jira Cloud no longer renders Wiki Markup formatting (the original template format used code blocks with
{code:title=Message|borderStyle=solid}).Solution: Converted all templates from Wiki Markup to Atlassian Document Format (ADF), which is the required format for Jira Cloud.
6. ADF Comment Creation Failure (INVALID_INPUT)
Problem: After implementing ADF structure, issue creation worked perfectly but comment creation failed with:
{ "errorMessages": ["INVALID_INPUT"], "errors": {"comment": "INVALID_INPUT"} }Investigation:
textfieldRoot Cause: When BUILD TAG or ORCHESTRATOR fields were empty strings, the code created text nodes like:
The Go JSON marshaler was serializing this as
{"type":"text"}(omitting the emptytextfield entirely), which violated ADF schema requirements. ADF text nodes must have atextfield, even if it's an empty string.Solution: Added explicit checks to replace empty strings with a space character:
This ensures the JSON always includes the text field:
{"type":"text","text":" "}Testing
Created Issues (Examples)
Environment Variables
The tool now requires two environment variables for Jira Cloud authentication:
Breaking Changes
JIRA_USER(email) in addition toJIRA_TOKENhttps://instance.atlassian.net) not UI pathsReferences