Skip to content
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

Release 5.12.1 #74

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
java-version: '21'

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/manually-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
java-version: '21'

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
java-version: '21'

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
82 changes: 37 additions & 45 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import com.github.spotbugs.SpotBugsTask

plugins {
id "io.spring.dependency-management" version "1.0.9.RELEASE"
id "io.spring.dependency-management" version "1.1.4"
id 'java'
id 'jacoco'
id "com.github.spotbugs" version "3.0.0"
id "com.github.node-gradle.node" version "2.2.1"
id 'nu.studer.jooq' version '3.0.3'
}

apply from: 'project-properties.gradle'

def scriptsUrl = 'https://raw.githubusercontent.com/reportportal/gradle-scripts/' +
(releaseMode ? getProperty('scripts.version') : 'develop')

apply from: 'jooq.gradle'
apply from: 'ui.gradle'
apply from: scriptsUrl + '/release-fat.gradle'
apply from: scriptsUrl + '/signing.gradle'
Expand All @@ -35,47 +30,29 @@ dependencyManagement {
}

dependencies {
// ALL new dependencies should be included in shadowJar plugin!
// transitive dependencies may be required as well. could be checked in runtime only!
if (releaseMode) {
implementation 'com.epam.reportportal:commons-dao'
implementation 'com.epam.reportportal:plugin-api'
annotationProcessor 'com.epam.reportportal:plugin-api'
} else {
implementation 'com.github.reportportal:commons-dao:acf1ec7'
implementation 'com.github.reportportal:plugin-api:188792e'
annotationProcessor 'com.github.reportportal:plugin-api:188792e'
implementation 'com.github.reportportal:commons-dao:8dcc514'
implementation 'com.github.reportportal:plugin-api:815c74a'
annotationProcessor 'com.github.reportportal:plugin-api:815c74a'
}
implementation 'org.hibernate:hibernate-core:5.6.15.Final'

implementation group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
implementation group: 'org.jooq', name: 'jooq', version: '3.14.4'
jooqRuntime 'org.postgresql:postgresql:42.7.3'

compile 'ch.qos.logback:logback-classic:1.2.3'
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'

testImplementation('org.junit.jupiter:junit-jupiter:5.6.0')
implementation("com.atlassian.jira:jira-rest-java-client-core:6.0.1")
implementation "io.atlassian.fugue:fugue:6.0.1"

}

spotbugs {
sourceSets = [sourceSets.main]
reportLevel = "high"
}
tasks.withType(SpotBugsTask) {
reports {
xml.enabled false
html.enabled true
}
testImplementation('org.junit.jupiter:junit-jupiter:5.11.0')
}

test {
useJUnitPlatform()
jacocoTestReport {
reports {
xml.enabled true
xml.required = true
}
}
}
Expand Down Expand Up @@ -106,7 +83,7 @@ jar {
}
manifest {
attributes(
"Class-Path": configurations.compile.collect { it.getName() }.join(' '),
"Class-Path": configurations.compileClasspath.collect { it.getName() }.join(' '),
"Plugin-Id": "${pluginId}",
"Plugin-Version": "${project.version}",
"Plugin-Provider": "Report Portal",
Expand All @@ -124,17 +101,32 @@ shadowJar {
from("ui/build") {
into("/resources")
}
configurations = [project.configurations.compile]
configurations = [project.configurations.compileClasspath]
zip64 true
dependencies {
exclude(dependency('com.github.reportportal:'))
exclude(dependency('com.epam.reportportal:'))
exclude(dependency('org.springframework:'))
exclude(dependency('org.springframework.security:'))
exclude(dependency('org.springframework.data:'))
exclude(dependency('org.springframework.boot:'))
exclude(dependency('ch.qos.logback:'))
exclude(dependency('org.slf4j:'))
include(dependency("com.atlassian.jira:jira-rest-java-client-api:.*"))
include(dependency("com.atlassian.jira:jira-rest-java-client-core:.*"))
include(dependency("com.atlassian.httpclient:atlassian-httpclient-api:.*"))
include(dependency("com.atlassian.httpclient:atlassian-httpclient-library:.*"))
include(dependency("com.atlassian.sal:sal-api:.*"))
include(dependency("com.atlassian.event:atlassian-event:.*"))
include(dependency("io.atlassian.util.concurrent:atlassian-util-concurrent:.*"))
include(dependency("io.atlassian.fugue:fugue:.*"))
include(dependency("org.apache.httpcomponents:httpasyncclient:.*"))
include(dependency("org.apache.httpcomponents:httpasyncclient-cache:.*"))
include(dependency("org.apache.httpcomponents:httpclient:.*"))
include(dependency("org.apache.httpcomponents:httpclient-cache:.*"))
include(dependency("org.apache.httpcomponents:httpcore:.*"))
include(dependency("org.apache.httpcomponents:httpcore-nio:.*"))
include(dependency("org.apache.httpcomponents:httpcore-mime:.*"))
include(dependency("org.glassfish.jersey.core:jersey-server:.*"))
include(dependency("org.glassfish.jersey.core:jersey-common:.*"))
include(dependency("jakarta.ws.rs:jakarta.ws.rs-api:.*"))
//include(dependency("jakarta.annotation:jakarta.annotation-api:.*"))
include(dependency("org.apache.tomcat:tomcat-annotations-api:.*"))
include(dependency("org.glassfish.hk2.external:jakarta.inject:.*"))
include(dependency("org.glassfish.hk2:osgi-resource-locator:.*"))
include(dependency("org.glassfish.jaxb:jaxb-runtime:.*"))
}
}

Expand All @@ -144,9 +136,9 @@ task plugin(type: Jar) {
with jar
}
into('lib') {
from configurations.compile
from configurations.compileClasspath
}
extension('zip')
archiveExtension.set('zip')
}

task assemblePlugin(type: Copy) {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Fri Mar 13 14:15:13 MSK 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 1 addition & 7 deletions jooq.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
jooq {
version = '3.12.4'
edition = 'OSS'
sample(sourceSets.main) {
configuration {
jdbc {
driver = 'org.postgresql.Driver'
url = 'jdbc:postgresql://localhost:5432/reportportal'
Expand Down Expand Up @@ -33,8 +31,4 @@ jooq {
}
}
}
}

generateSampleJooqSchemaSource {
enabled = false
}
10 changes: 4 additions & 6 deletions project-properties.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

project.ext {
publishRepo = "https://maven.pkg.github.com/reportportal/plugin-bts-jira-cloud"
dependencyRepos = ["plugin-api", "commons-bom"]
releaseMode = project.hasProperty("releaseMode")
pluginsDir = "$buildDir/plugins"
}

wrapper {
gradleVersion = '5.4.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import com.epam.reportportal.extension.jira.command.GetIssueTypesCommand;
import com.epam.reportportal.extension.jira.command.PostTicketCommand;
import com.epam.reportportal.extension.jira.command.RetrieveCreationParamsCommand;
import com.epam.reportportal.extension.jira.command.RetrieveUpdateParamsCommand;
import com.epam.reportportal.extension.jira.command.UserSearchCommand;
import com.epam.reportportal.extension.jira.command.atlassian.CloudJiraClientProviderExtended;
import com.epam.reportportal.extension.jira.command.RetrieveUpdateParamsCommand;
import com.epam.reportportal.extension.jira.command.connection.TestConnectionCommand;
import com.epam.reportportal.extension.jira.command.utils.CloudJiraClientProvider;
import com.epam.reportportal.extension.jira.command.utils.JIRATicketDescriptionService;
Expand Down Expand Up @@ -62,7 +62,6 @@
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.jasypt.util.text.BasicTextEncryptor;
import org.jooq.DSLContext;
import org.pf4j.Extension;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -77,7 +76,6 @@
*/
@Extension
public class CloudJiraExtension implements ReportPortalExtensionPoint, DisposableBean {

private static final String DOCUMENTATION_LINK_FIELD = "documentationLink";
private static final String DOCUMENTATION_LINK = "https://reportportal.io/docs/plugins/AtlassianJiraCloud";
public static final String BINARY_DATA_PROPERTIES_FILE_ID = "binary-data.properties";
Expand All @@ -104,10 +102,6 @@ public class CloudJiraExtension implements ReportPortalExtensionPoint, Disposabl

@Autowired
private ApplicationContext applicationContext;

@Autowired
private DSLContext dsl;

@Autowired
private IntegrationTypeRepository integrationTypeRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@
import com.epam.reportportal.extension.PluginCommand;
import com.epam.reportportal.extension.jira.command.utils.CloudJiraClientProvider;
import com.epam.reportportal.extension.jira.command.utils.CloudJiraProperties;
import com.epam.reportportal.extension.jira.utils.IntegrationValidator;
import com.epam.reportportal.rules.exception.ErrorType;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.epam.ta.reportportal.entity.integration.Integration;
import com.epam.ta.reportportal.entity.integration.IntegrationParams;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.epam.reportportal.rules.exception.ErrorType;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static java.util.Optional.ofNullable;

/**
* @author <a href="mailto:pavel_bortnik@epam.com">Pavel Bortnik</a>
*/
Expand Down Expand Up @@ -60,6 +59,7 @@ public Boolean executeCommand(Integration integration, Map<String, Object> param
() -> new ReportPortalException(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION,
"Project key is not specified."
));
IntegrationValidator.validateThirdPartyUrl(integration);

try (JiraRestClient restClient = cloudJiraClientProvider.get(integrationParams)) {
return restClient.getProjectClient().getProject(project).claim() != null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.epam.reportportal.extension.jira.utils;

import com.epam.reportportal.rules.commons.validation.BusinessRule;
import com.epam.reportportal.rules.commons.validation.Suppliers;
import com.epam.reportportal.rules.exception.ErrorType;
import com.epam.ta.reportportal.commons.Predicates;
import com.epam.ta.reportportal.entity.integration.Integration;
import java.util.regex.Pattern;

/**
* @author <a href="mailto:siarhei_hrabko@epam.com">Siarhei Hrabko</a>
*/
public final class IntegrationValidator {

private static final String JIRA_URL_PATTERN = "https://[^?]*\\.atlassian\\.(com|net).*";

private IntegrationValidator() {
//static only
}


/**
* Validates Validates Rally server url.
*
* @param integration {@link Integration}
*/
public static void validateThirdPartyUrl(Integration integration) {
var valid = Pattern.matches(JIRA_URL_PATTERN,
String.valueOf(integration.getParams().getParams().get("url")));

BusinessRule.expect(valid, Predicates.equalTo(true))
.verify(ErrorType.BAD_REQUEST_ERROR,
Suppliers.formattedSupplier("Integration url is not acceptable")
);
}
}
Loading
Loading