From 4c9da33a568a2fb8783c33aea539a2aadbfceaba Mon Sep 17 00:00:00 2001 From: APiankouski <109206864+APiankouski@users.noreply.github.com> Date: Tue, 8 Aug 2023 12:49:41 +0300 Subject: [PATCH 1/5] Merge master to develop (#46) * [Gradle Release Plugin] - new version commit: '5.7.2'. * [Gradle Release Plugin] - new version commit: '5.7.3'. * [Gradle Release Plugin] - new version commit: '5.7.4'. * [Gradle Release Plugin] - new version commit: '5.7.5'. * Add shadowJar artifacts * [Gradle Release Plugin] - new version commit: '5.7.6'. * Downgrade gradlew version * [Gradle Release Plugin] - new version commit: '5.7.7'. * Downgrade gradlew version * Bump spring dependency management version * [Gradle Release Plugin] - new version commit: '5.7.8'. * 5.7.0 || Update version * [Gradle Release Plugin] - new version commit: '5.7.1'. * Update promote.yml * Update promote.yml * Update promote.yml * [Gradle Release Plugin] - new version commit: '5.7.2'. * EPMRPP-78476 || Fix promote * [Gradle Release Plugin] - new version commit: '5.7.3'. * EPMRPP-82057 || Impossible to interact with Jira Server version 9+ * [Gradle Release Plugin] - new version commit: '5.7.4'. * [Gradle Release Plugin] - new version commit: '5.7.5'. * Fix promote --------- Co-authored-by: Pavel Bortnik Co-authored-by: reportportal.io Co-authored-by: Vadzim Hushchanskou Co-authored-by: Andrei Piankouski --- .github/workflows/promote.yml | 13 +- build.gradle | 11 +- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../bugtracking/jira/JIRATicketUtils.java | 26 ++-- .../bugtracking/jira/JiraStrategy.java | 48 +++++--- .../AsynchronousIssueRestClientExtended.java | 35 ++++++ .../AsynchronousJiraRestClientExtended.java | 115 ++++++++++++++++++ .../atlassian/CimFieldsInfoJsonParserExt.java | 19 +++ .../CreateIssueMetaFieldsParserExt.java | 22 ++++ 10 files changed, 244 insertions(+), 49 deletions(-) create mode 100644 src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/AsynchronousIssueRestClientExtended.java create mode 100644 src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/AsynchronousJiraRestClientExtended.java create mode 100644 src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/CimFieldsInfoJsonParserExt.java create mode 100644 src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/CreateIssueMetaFieldsParserExt.java diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index e477aee..0174d39 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -23,7 +23,7 @@ on: env: REPOSITORY_URL: 'https://maven.pkg.github.com' UPSTREAM_REPOSITORY_URL: 'https://oss.sonatype.org' - PACKAGE_SUFFIXES: '-javadoc.jar,-javadoc.jar.asc,-sources.jar,-sources.jar.asc,-all.jar,all.jar.asc,.pom,.pom.asc' + PACKAGE_SUFFIXES: '-javadoc.jar,-javadoc.jar.asc,-sources.jar,-sources.jar.asc,.jar,.jar.asc,.pom,.pom.asc' PACKAGE: 'com.epam.reportportal' @@ -32,13 +32,6 @@ jobs: runs-on: ubuntu-latest steps: - - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: '11' - - name: Get variables run: | echo "ARTIFACT=`echo ${{ github.repository }} | cut -d/ -f2- | awk '{print tolower($0)}'`" >> $GITHUB_ENV @@ -58,7 +51,7 @@ jobs: export BUNDLE_FILE="bundle.jar" jar -cvf ${BUNDLE_FILE} "${files[@]}" echo 'Bundle upload' - curl -u ${{ secrets.SONATYPE_USER }}:${{ secrets.SONATYPE_PASSWORD }} -L \ + curl -f -u ${{ secrets.SONATYPE_USER }}:${{ secrets.SONATYPE_PASSWORD }} -L \ --request POST '${{ env.UPSTREAM_REPOSITORY_URL }}/service/local/staging/bundle_upload' \ --form "file=@${BUNDLE_FILE}" >response.json response_type=`jq type response.json || echo ''` @@ -105,4 +98,4 @@ jobs: else echo 'Verification failed, please check the bundle' 1>&2 exit 1 - fi \ No newline at end of file + fi diff --git a/build.gradle b/build.gradle index 0d85f69..e843510 100755 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id "io.spring.dependency-management" version "1.0.8.RELEASE" + id "io.spring.dependency-management" version "1.0.9.RELEASE" id 'java' id 'jacoco' } @@ -59,7 +59,7 @@ dependencies { compile 'org.slf4j:slf4j-api:1.7.25' compile 'io.atlassian.fugue:fugue:4.7.2' - compile('com.atlassian.jira:jira-rest-java-client-core:5.2.1') + compile('com.atlassian.jira:jira-rest-java-client-core:5.2.4') compile 'net.oauth.core:oauth:20090617' compile 'net.oauth.core:oauth-httpclient4:20090913' @@ -72,6 +72,10 @@ dependencies { testCompile 'org.mockito:mockito-all:1.10.19' } +artifacts { + archives shadowJar +} + test { jacocoTestReport { reports { @@ -83,7 +87,7 @@ test { build.dependsOn jacocoTestReport wrapper { - gradleVersion = '6.0' + gradleVersion = '5.4.1' } generatePomFileForShadowPublication { pom.packaging = "jar" } @@ -103,6 +107,7 @@ jar { } shadowJar { + archiveClassifier.set(null) configurations = [project.configurations.compile] zip64 true dependencies { diff --git a/gradle.properties b/gradle.properties index e6f1eac..f59407a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version=5.7.1 +version=5.7.5 description=EPAM Report portal. Jira Integration Plugin diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 95a3c55..ffcf1a9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Mon Feb 17 14:41:54 MSK 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JIRATicketUtils.java b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JIRATicketUtils.java index 26c90c4..acc5091 100755 --- a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JIRATicketUtils.java +++ b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JIRATicketUtils.java @@ -21,8 +21,6 @@ package com.epam.reportportal.extension.bugtracking.jira; -import com.atlassian.jira.rest.client.api.GetCreateIssueMetadataOptions; -import com.atlassian.jira.rest.client.api.GetCreateIssueMetadataOptionsBuilder; import com.atlassian.jira.rest.client.api.JiraRestClient; import com.atlassian.jira.rest.client.api.domain.*; import com.atlassian.jira.rest.client.api.domain.input.ComplexIssueInputFieldValue; @@ -37,6 +35,7 @@ import com.epam.ta.reportportal.ws.model.externalsystem.Ticket; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; +import com.google.common.collect.Streams; import org.apache.commons.collections.CollectionUtils; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; @@ -44,10 +43,8 @@ import org.slf4j.LoggerFactory; import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Optional; +import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -81,17 +78,16 @@ public static IssueInput toIssueInput(JiraRestClient client, Project jiraProject JIRATicketDescriptionService descriptionService) { String userDefinedDescription = ""; IssueInputBuilder issueInputBuilder = new IssueInputBuilder(jiraProject, issueType.get()); - GetCreateIssueMetadataOptions options = new GetCreateIssueMetadataOptionsBuilder().withExpandedIssueTypesFields() - .withProjectKeys(jiraProject.getKey()) - .build(); - Iterator projects = client.getIssueClient().getCreateIssueMetadata(options).claim().iterator(); - BusinessRule.expect(projects.hasNext(), Predicates.equalTo(true)) - .verify(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, String.format("Project %s not found", jiraProject.getKey())); - CimProject project = projects.next(); - CimIssueType cimIssueType = EntityHelper.findEntityById(project.getIssueTypes(), issueType.get().getId()); + Page fieldsInfoPage = client.getIssueClient() + .getCreateIssueMetaFields(jiraProject.getKey(), issueType.get().getId().toString(), null, null) + .claim(); + BusinessRule.expect(fieldsInfoPage.getValues().iterator().hasNext(), Predicates.equalTo(true)) + .verify(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, String.format("Issue fields %s not found", issueType.get().getId().toString())); + Map fieldsInfo = Streams.stream(fieldsInfoPage.getValues()) + .collect(Collectors.toMap(CimFieldInfo::getId, Function.identity())); List fields = ticketRQ.getFields(); for (PostFormField one : fields) { - CimFieldInfo cimFieldInfo = cimIssueType.getFields().get(one.getId()); + CimFieldInfo cimFieldInfo = fieldsInfo.get(one.getId()); if (one.getIsRequired() && CollectionUtils.isEmpty(one.getValue())) { BusinessRule.fail().withError(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, Suppliers.formattedSupplier("Required parameter '{}' is empty", one.getFieldName()) diff --git a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java index 41dbb90..f5d0f4a 100755 --- a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java +++ b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java @@ -21,19 +21,20 @@ package com.epam.reportportal.extension.bugtracking.jira; -import com.atlassian.jira.rest.client.api.GetCreateIssueMetadataOptions; -import com.atlassian.jira.rest.client.api.GetCreateIssueMetadataOptionsBuilder; import com.atlassian.jira.rest.client.api.JiraRestClient; import com.atlassian.jira.rest.client.api.domain.*; import com.atlassian.jira.rest.client.api.domain.input.AttachmentInput; import com.atlassian.jira.rest.client.api.domain.input.IssueInput; import com.atlassian.jira.rest.client.auth.BasicHttpAuthenticationHandler; +import com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory; import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory; +import com.atlassian.jira.rest.client.internal.async.DisposableHttpClient; import com.epam.reportportal.extension.CommonPluginCommand; import com.epam.reportportal.extension.IntegrationGroupEnum; import com.epam.reportportal.extension.PluginCommand; import com.epam.reportportal.extension.ReportPortalExtensionPoint; import com.epam.reportportal.extension.bugtracking.BtsExtension; +import com.epam.reportportal.extension.bugtracking.jira.atlassian.AsynchronousJiraRestClientExtended; import com.epam.ta.reportportal.binary.DataStoreService; import com.epam.ta.reportportal.commons.Preconditions; import com.epam.ta.reportportal.commons.validation.BusinessRule; @@ -85,7 +86,6 @@ @Component public class JiraStrategy implements ReportPortalExtensionPoint, BtsExtension { - private static final String BUG = "Bug"; private static final Logger LOGGER = LoggerFactory.getLogger(JiraStrategy.class); @Autowired @@ -324,15 +324,12 @@ public List getTicketFields(final String ticketType, Integration BusinessRule.expect(issueType, Preconditions.IS_PRESENT) .verify(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Ticket type '" + ticketType + "' not found"); - GetCreateIssueMetadataOptions options = new GetCreateIssueMetadataOptionsBuilder().withExpandedIssueTypesFields() - .withProjectKeys(jiraProject.getKey()) - .build(); - Iterable projects = client.getIssueClient().getCreateIssueMetadata(options).claim(); - CimProject project = projects.iterator().next(); - CimIssueType cimIssueType = EntityHelper.findEntityById(project.getIssueTypes(), issueType.get().getId()); - for (String key : cimIssueType.getFields().keySet()) { + Page fields = client.getIssueClient() + .getCreateIssueMetaFields(jiraProject.getKey(), issueType.get().getId().toString(), null, null) + .claim(); + Iterable values = fields.getValues(); + for (CimFieldInfo issueField : values) { List defValue = null; - CimFieldInfo issueField = cimIssueType.getFields().get(key); // Field ID for next JIRA POST ticket requests String fieldID = issueField.getId(); String fieldType = issueField.getSchema().getType(); @@ -367,12 +364,10 @@ public List getTicketFields(final String ticketType, Integration } } if (fieldID.equalsIgnoreCase(IssueFieldId.PRIORITY_FIELD.id)) { - if (null != cimIssueType.getField(IssueFieldId.PRIORITY_FIELD)) { - Iterable allowedValuesForPriority = cimIssueType.getField(IssueFieldId.PRIORITY_FIELD).getAllowedValues(); - for (Object singlePriority : allowedValuesForPriority) { - BasicPriority priority = (BasicPriority) singlePriority; - allowed.add(new AllowedValue(String.valueOf(priority.getId()), priority.getName())); - } + Iterable allowedValuesForPriority = issueField.getAllowedValues(); + for (Object singlePriority : allowedValuesForPriority) { + BasicPriority priority = (BasicPriority) singlePriority; + allowed.add(new AllowedValue(String.valueOf(priority.getId()), priority.getName())); } } if (fieldID.equalsIgnoreCase(IssueFieldId.ISSUE_TYPE_FIELD.id)) { @@ -483,9 +478,24 @@ public JiraRestClient getClient(IntegrationParams params) { String password = JiraProps.PASSWORD.getParam(params) .orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Password is not specified.")); - return new AsynchronousJiraRestClientFactory().create(URI.create(url), - new BasicHttpAuthenticationHandler(username, simpleEncryptor.decrypt(password)) + DisposableHttpClient httpClient = (new AsynchronousHttpClientFactory()).createClient(URI.create(url), new BasicHttpAuthenticationHandler(username, simpleEncryptor.decrypt(password)) + ); + return new AsynchronousJiraRestClientExtended(URI.create(url), httpClient); + } + + public JiraRestClient getClient(IntegrationParams params, PostTicketRQ postTicketRQ) { + String url = JiraProps.URL.getParam(params) + .orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "Url is not specified.")); + String username = ofNullable(postTicketRQ.getUsername()).orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, + "Username is not specified." + )); + String password = ofNullable(postTicketRQ.getPassword()).orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, + "Password is not specified." + )); + + DisposableHttpClient httpClient = (new AsynchronousHttpClientFactory()).createClient(URI.create(url), new BasicHttpAuthenticationHandler(username, password) ); + return new AsynchronousJiraRestClientExtended(URI.create(url), httpClient); } } diff --git a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/AsynchronousIssueRestClientExtended.java b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/AsynchronousIssueRestClientExtended.java new file mode 100644 index 0000000..3ca25d8 --- /dev/null +++ b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/AsynchronousIssueRestClientExtended.java @@ -0,0 +1,35 @@ +package com.epam.reportportal.extension.bugtracking.jira.atlassian; + +import com.atlassian.httpclient.api.HttpClient; +import com.atlassian.jira.rest.client.api.MetadataRestClient; +import com.atlassian.jira.rest.client.api.SessionRestClient; +import com.atlassian.jira.rest.client.api.domain.CimFieldInfo; +import com.atlassian.jira.rest.client.api.domain.Page; +import com.atlassian.jira.rest.client.internal.async.AsynchronousIssueRestClient; +import io.atlassian.util.concurrent.Promise; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.ws.rs.core.UriBuilder; +import java.net.URI; + +/** + * Temporary solution, should be removed after jira-rest-java-client-core update. + */ +public class AsynchronousIssueRestClientExtended extends AsynchronousIssueRestClient { + + private final URI baseUri; + + public AsynchronousIssueRestClientExtended(URI baseUri, HttpClient client, SessionRestClient sessionRestClient, MetadataRestClient metadataRestClient) { + super(baseUri, client, sessionRestClient, metadataRestClient); + this.baseUri = baseUri; + } + + @Override + public Promise> getCreateIssueMetaFields(@Nonnull final String projectIdOrKey, @Nonnull final String issueTypeId, + @Nullable final Long startAt, @Nullable final Integer maxResults) { + final UriBuilder uriBuilder = UriBuilder.fromUri(baseUri).path("issue/createmeta/" + projectIdOrKey + "/issuetypes/" + issueTypeId); + + return getAndParse(uriBuilder.build(), new CreateIssueMetaFieldsParserExt()); + } +} diff --git a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/AsynchronousJiraRestClientExtended.java b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/AsynchronousJiraRestClientExtended.java new file mode 100644 index 0000000..6b101f3 --- /dev/null +++ b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/AsynchronousJiraRestClientExtended.java @@ -0,0 +1,115 @@ +package com.epam.reportportal.extension.bugtracking.jira.atlassian; + +import com.atlassian.jira.rest.client.api.*; +import com.atlassian.jira.rest.client.internal.async.*; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.net.URI; + +/** + * Temporary solution, should be removed after jira-rest-java-client-core update. + */ +public class AsynchronousJiraRestClientExtended implements JiraRestClient { + + private final IssueRestClient issueRestClient; + private final SessionRestClient sessionRestClient; + private final UserRestClient userRestClient; + private final GroupRestClient groupRestClient; + private final ProjectRestClient projectRestClient; + private final ComponentRestClient componentRestClient; + private final MetadataRestClient metadataRestClient; + private final SearchRestClient searchRestClient; + private final VersionRestClient versionRestClient; + private final ProjectRolesRestClient projectRolesRestClient; + private final MyPermissionsRestClient myPermissionsRestClient; + private final DisposableHttpClient httpClient; + private final AuditRestClient auditRestClient; + + public AsynchronousJiraRestClientExtended(final URI serverUri, final DisposableHttpClient httpClient) { + final URI baseUri = UriBuilder.fromUri(serverUri).path("/rest/api/latest").build(); + + this.httpClient = httpClient; + metadataRestClient = new AsynchronousMetadataRestClient(baseUri, httpClient); + sessionRestClient = new AsynchronousSessionRestClient(serverUri, httpClient); + issueRestClient = new AsynchronousIssueRestClientExtended(baseUri, httpClient, sessionRestClient, metadataRestClient); + userRestClient = new AsynchronousUserRestClient(baseUri, httpClient); + groupRestClient = new AsynchronousGroupRestClient(baseUri, httpClient); + projectRestClient = new AsynchronousProjectRestClient(baseUri, httpClient); + componentRestClient = new AsynchronousComponentRestClient(baseUri, httpClient); + searchRestClient = new AsynchronousSearchRestClient(baseUri, httpClient); + versionRestClient = new AsynchronousVersionRestClient(baseUri, httpClient); + projectRolesRestClient = new AsynchronousProjectRolesRestClient(serverUri, httpClient); + myPermissionsRestClient = null; + auditRestClient = null; + } + + @Override + public IssueRestClient getIssueClient() { + return issueRestClient; + } + + @Override + public SessionRestClient getSessionClient() { + return sessionRestClient; + } + + @Override + public UserRestClient getUserClient() { + return userRestClient; + } + + @Override + public GroupRestClient getGroupClient() { + return groupRestClient; + } + + @Override + public ProjectRestClient getProjectClient() { + return projectRestClient; + } + + @Override + public ComponentRestClient getComponentClient() { + return componentRestClient; + } + + @Override + public MetadataRestClient getMetadataClient() { + return metadataRestClient; + } + + @Override + public SearchRestClient getSearchClient() { + return searchRestClient; + } + + @Override + public VersionRestClient getVersionRestClient() { + return versionRestClient; + } + + @Override + public ProjectRolesRestClient getProjectRolesRestClient() { + return projectRolesRestClient; + } + + @Override + public MyPermissionsRestClient getMyPermissionsRestClient() { + return myPermissionsRestClient; + } + + @Override + public AuditRestClient getAuditRestClient() { + return auditRestClient; + } + + @Override + public void close() throws IOException { + try { + httpClient.destroy(); + } catch (Exception e) { + throw (e instanceof IOException) ? ((IOException) e) : new IOException(e); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/CimFieldsInfoJsonParserExt.java b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/CimFieldsInfoJsonParserExt.java new file mode 100644 index 0000000..68e36fb --- /dev/null +++ b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/CimFieldsInfoJsonParserExt.java @@ -0,0 +1,19 @@ +package com.epam.reportportal.extension.bugtracking.jira.atlassian; + +import com.atlassian.jira.rest.client.api.domain.CimFieldInfo; +import com.atlassian.jira.rest.client.internal.json.CimFieldsInfoJsonParser; +import com.atlassian.jira.rest.client.internal.json.JsonParseUtil; +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; + +/** + * Temporary solution, should be removed after jira-rest-java-client-core update. + */ +public class CimFieldsInfoJsonParserExt extends CimFieldsInfoJsonParser { + + @Override + public CimFieldInfo parse(JSONObject json) throws JSONException { + final String id = JsonParseUtil.getOptionalString(json, "fieldId"); + return parse(json, id); + } +} diff --git a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/CreateIssueMetaFieldsParserExt.java b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/CreateIssueMetaFieldsParserExt.java new file mode 100644 index 0000000..2a5a16f --- /dev/null +++ b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/atlassian/CreateIssueMetaFieldsParserExt.java @@ -0,0 +1,22 @@ +package com.epam.reportportal.extension.bugtracking.jira.atlassian; + +import com.atlassian.jira.rest.client.api.domain.CimFieldInfo; +import com.atlassian.jira.rest.client.api.domain.Page; +import com.atlassian.jira.rest.client.internal.json.CreateIssueMetaFieldsParser; +import com.atlassian.jira.rest.client.internal.json.GenericJsonArrayParser; +import com.atlassian.jira.rest.client.internal.json.PageJsonParser; +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; + +/** + * Temporary solution, should be removed after jira-rest-java-client-core update. + */ +public class CreateIssueMetaFieldsParserExt extends CreateIssueMetaFieldsParser { + + private final PageJsonParser pageParser = new PageJsonParser<>(new GenericJsonArrayParser(new CimFieldsInfoJsonParserExt())); + + @Override + public Page parse(JSONObject json) throws JSONException { + return pageParser.parse(json); + } +} From 44c142e47759629c7a79f83cc538058e7c389c22 Mon Sep 17 00:00:00 2001 From: Andrei Piankouski Date: Tue, 29 Aug 2023 14:19:13 +0300 Subject: [PATCH 2/5] EPMRPP-78914 || Redesign integrations. Link updates --- .../extension/bugtracking/jira/JiraStrategy.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java index f5d0f4a..b45c337 100755 --- a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java +++ b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java @@ -86,6 +86,9 @@ @Component public class JiraStrategy implements ReportPortalExtensionPoint, BtsExtension { + private static final String DOCUMENTATION_LINK_FIELD = "documentationLink"; + private static final String DOCUMENTATION_LINK = "https://reportportal.io/docs/plugins/JiraServer"; + private static final Logger LOGGER = LoggerFactory.getLogger(JiraStrategy.class); @Autowired @@ -108,7 +111,9 @@ public class JiraStrategy implements ReportPortalExtensionPoint, BtsExtension { @Override public Map getPluginParams() { - return Collections.emptyMap(); + Map params = new HashMap<>(); + params.put(DOCUMENTATION_LINK_FIELD, DOCUMENTATION_LINK); + return params; } @Override From 4edb74d481c872561f971907e0d3cd4f2e294f84 Mon Sep 17 00:00:00 2001 From: siarhei_hrabko Date: Mon, 23 Oct 2023 11:41:06 +0300 Subject: [PATCH 3/5] EPMRPP-86867 || fixed documentation link --- .../reportportal/extension/bugtracking/jira/JiraStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java index b45c337..f0728aa 100755 --- a/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java +++ b/src/main/java/com/epam/reportportal/extension/bugtracking/jira/JiraStrategy.java @@ -87,7 +87,7 @@ public class JiraStrategy implements ReportPortalExtensionPoint, BtsExtension { private static final String DOCUMENTATION_LINK_FIELD = "documentationLink"; - private static final String DOCUMENTATION_LINK = "https://reportportal.io/docs/plugins/JiraServer"; + private static final String DOCUMENTATION_LINK = "https://reportportal.io/docs/plugins/AtlassianJiraServer"; private static final Logger LOGGER = LoggerFactory.getLogger(JiraStrategy.class); From 08b0035e64db35a80a830090d6847529a4437091 Mon Sep 17 00:00:00 2001 From: Pavel Bortnik Date: Wed, 20 Dec 2023 17:24:27 +0300 Subject: [PATCH 4/5] rc/5.11.0 || Update release version --- .github/workflows/release.yml | 4 ++-- build.gradle | 21 ++++++--------------- gradle.properties | 2 +- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c077461..b0cb800 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,8 +11,8 @@ on: env: GH_USER_NAME: github.actor - SCRIPTS_VERSION: 5.7.0 - BOM_VERSION: 5.7.0 + SCRIPTS_VERSION: 5.10.0 + BOM_VERSION: 5.11.2 REPOSITORY_URL: 'https://maven.pkg.github.com/' jobs: diff --git a/build.gradle b/build.gradle index e843510..9e2bdc0 100755 --- a/build.gradle +++ b/build.gradle @@ -20,26 +20,17 @@ apply from: scriptsUrl + '/signing.gradle' apply from: scriptsUrl + '/build-quality.gradle' repositories { - mavenCentral() maven { url "https://m2proxy.atlassian.com/repository/public" } - if (releaseMode) { - dependencyRepos.forEach { path -> - maven { - setUrl("https://maven.pkg.github.com/reportportal/${path}") - credentials { - username = findProperty("githubUserName") - password = findProperty("githubToken") - } - } - } - } else { + mavenCentral { url "https://repo1.maven.org/maven2" } + + if (!releaseMode) { maven { url 'https://jitpack.io' } } } dependencyManagement { imports { - mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:' + getProperty('bom.version') : 'com.github.reportportal:commons-bom:4b7ed8a') + mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:' + getProperty('bom.version') : 'com.epam.reportportal:commons-bom:5.11.2') } } @@ -51,8 +42,8 @@ dependencies { implementation 'com.epam.reportportal:plugin-api' annotationProcessor 'com.epam.reportportal:plugin-api' } else { - implementation 'com.github.reportportal:plugin-api:886ac55' - annotationProcessor 'com.github.reportportal:plugin-api:886ac55' + implementation 'com.epam.reportportal:plugin-api' + annotationProcessor 'com.epam.reportportal:plugin-api' } compile 'ch.qos.logback:logback-classic:1.2.3' diff --git a/gradle.properties b/gradle.properties index f59407a..4877d9b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version=5.7.5 +version=5.11.0 description=EPAM Report portal. Jira Integration Plugin From d8840770fb457d004b4c774a6c77d2d910be171e Mon Sep 17 00:00:00 2001 From: Pavel Bortnik Date: Wed, 20 Dec 2023 17:26:55 +0300 Subject: [PATCH 5/5] rc/5.11.0 || Add build workflow --- .github/workflows/build.yml | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a508772 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Build + +on: + pull_request: + push: + branches: + - master + - develop + paths-ignore: + - '.github/**' + - README.md + - gradle.properties + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup git credentials + uses: oleksiyrudenko/gha-git-credentials@v2 + with: + name: 'reportportal.io' + email: 'support@reportportal.io' + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Build with Gradle + id: build + run: | + ./gradlew build