From 9c8036b56cd214ee070f305ad66434e772feb225 Mon Sep 17 00:00:00 2001 From: Manuel Lara Date: Mon, 23 Oct 2023 04:27:30 -0300 Subject: [PATCH] Minor Updates (#304) * > Bamboo v7+ Support > Historical Fixes > Allure binary download, unzip, and so on was updated > All libraries was updated to newer versions > Removed the error when you add the allure task to any plan (only a log message is shown) Signed-off-by: Manuel Lara * > AllureArtifactsManager: Ensure the path URL, avoiding having two backslashes together when filePath is concatenated > AllureBuildCompleteAction: Fixing Report URL in the executor.json file. > AllureCommandLineSupport: Increasing timeout to 5 minutes > AllureReportServlet: Rollback URL Pattern Signed-off-by: Manuel Lara * > AllureBuildCompleteAction: Adding more historical info (trends and so on). Signed-off-by: Manuel Lara * > Customize the logo of each report from each build from the bamboo UI > Bug: When you try to uncheck an option from Bamboo UI the option is not saved. > Download Util class we created to download logo and allure binary > The deprecated logo was changed due to it being confused. (It is not deprecated, it is just not necessary) > The task description was changed > Bug: If you add an allure task to your plan the build fails due to API incompatibility Signed-off-by: Manuel Lara * > Bug-fixed: If a plan execution fails the history is missing for the next execution. Signed-off-by: Manuel Lara * > Plan Titles customization > Allure removed from the title. (it's not customizable) > A link was created to download the report for evidence in other systems. > The logo can have other types not only SVG. > Fix some dependencies conflicts Signed-off-by: Manuel Lara * > Change Version: 2.0, because the change in this version is major. Signed-off-by: Manuel Lara * Revert "> Change Version: 2.0, because the change in this version is major." This reverts commit d873df735e12a8c44f0929ac29e392f36f98ef8a. * Revert "Revert "> Change Version: 2.0, because the change in this version is major."" This reverts commit e143ff0d6ca32bd98a5ae63db46aa2a70b6f95c8. * > Change Version: 2.0 to 2.0-SNAPSHOT > amps.version to 8.0.3-89c970d65 Signed-off-by: Manuel Lara * update license Signed-off-by: Manuel Lara * > Fixes Signed-off-by: Manuel Lara * > Fixes: - Fixed custom logo error with multiple plans same agent. - Improved logo customization options with support for base64 URLs and various file extensions. Signed-off-by: Manuel Lara * > Fixes: - Fixed custom logo error with multiple plans same agent. - Improved logo customization options with support for base64 URLs and various file extensions. Signed-off-by: Manuel Lara * > Fixes: - Fixed custom logo error with multiple plans same agent. - Improved logo customization options with support for base64 URLs and various file extensions. Signed-off-by: Manuel Lara --------- Signed-off-by: Manuel Lara Co-authored-by: Dmitry Baev --- .github/workflows/release.yml | 2 +- .../quality-configs/checkstyle/checkstyle.xml | 14 ++--- .mvn/quality-configs/pmd/pmd.xml | 3 +- .mvn/quality-configs/spotbugs/exclude.xml | 2 +- README.md | 20 +++++-- pom.xml | 3 +- .../allure/bamboo/AllureArtifactsManager.java | 56 +++++++++---------- .../bamboo/AllureBuildCompleteAction.java | 7 ++- .../allure/bamboo/AllureBuildConfig.java | 5 +- .../allure/bamboo/AllureDownloader.java | 12 ++-- .../allure/bamboo/AllureExecutable.java | 29 ++++++++-- .../bamboo/AllureExecutableProvider.java | 2 +- .../allure/bamboo/AllureReportServlet.java | 4 +- .../bamboo/BambooExecutablesManager.java | 2 +- .../info/allurewidgets/summary/Statistic.java | 1 - .../info/allurewidgets/summary/Summary.java | 6 +- .../info/allurewidgets/summary/Time.java | 6 +- .../qameta/allure/bamboo/util/Downloader.java | 22 ++++---- src/main/resources/allure-bamboo.properties | 45 +++++++-------- .../editAllureBambooConfiguration.ftl | 4 +- .../templates/editAllureReportConfig.ftl | 32 +++++------ src/main/resources/templates/error.ftl | 20 +++---- .../resources/templates/viewAllureReport.ftl | 16 +++--- src/test/resources/log4j.properties | 6 +- 24 files changed, 173 insertions(+), 146 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 08e6887..5240253 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: release: - types: [published] + types: [ published ] jobs: build: diff --git a/.mvn/quality-configs/checkstyle/checkstyle.xml b/.mvn/quality-configs/checkstyle/checkstyle.xml index 7bac100..52ef7d5 100644 --- a/.mvn/quality-configs/checkstyle/checkstyle.xml +++ b/.mvn/quality-configs/checkstyle/checkstyle.xml @@ -104,10 +104,10 @@ - - - - + + + + @@ -136,9 +136,9 @@ - - - + + + diff --git a/.mvn/quality-configs/pmd/pmd.xml b/.mvn/quality-configs/pmd/pmd.xml index 8a239f0..f075ea8 100644 --- a/.mvn/quality-configs/pmd/pmd.xml +++ b/.mvn/quality-configs/pmd/pmd.xml @@ -112,7 +112,8 @@ - + diff --git a/.mvn/quality-configs/spotbugs/exclude.xml b/.mvn/quality-configs/spotbugs/exclude.xml index 4fa9242..5fa5c6b 100644 --- a/.mvn/quality-configs/spotbugs/exclude.xml +++ b/.mvn/quality-configs/spotbugs/exclude.xml @@ -13,7 +13,7 @@ you will have to use @NotNull annotation, which contradict with original contract (actually not, because guava intend weaker semantics). So disable this check to be able to properly use nullability annotations --> - + diff --git a/README.md b/README.md index 208042d..708bd79 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,29 @@ ## Allure Bamboo Plugin -This repository contains source code of Allure plugin for [Atlassian Bamboo CI](https://www.atlassian.com/software/bamboo). It allows you to generate Allure report from [existing Allure XML files](https://github.com/allure-framework/allure-core/wiki#gathering-information-about-tests). +This repository contains source code of Allure plugin +for [Atlassian Bamboo CI](https://www.atlassian.com/software/bamboo). It allows you to generate Allure report +from [existing Allure XML files](https://github.com/allure-framework/allure-core/wiki#gathering-information-about-tests). ### Building and Installing + #### Short way -Download precompiled JAR from [releases page](https://github.com/allure-framework/allure-bamboo-plugin/releases) and install it manually as described [here](https://confluence.atlassian.com/display/UPM/Installing+add-ons#Installingadd-ons-Installingbyfileupload). We use JDK 1.7+ to compile the plugin so be sure to use Java 1.7+ for running Bamboo. + +Download precompiled JAR from [releases page](https://github.com/allure-framework/allure-bamboo-plugin/releases) and +install it manually as +described [here](https://confluence.atlassian.com/display/UPM/Installing+add-ons#Installingadd-ons-Installingbyfileupload). +We use JDK 1.7+ to compile the plugin so be sure to use Java 1.7+ for running Bamboo. + #### Long way -1. Set up Atlassian plugin SDK as described [here](https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project). + +1. Set up Atlassian plugin SDK as +described [here](https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project). 2. Clone this repository 3. Run `$ atlas-run` 4. Access http://localhost:6990/bamboo/ to view development instance of Bamboo 5. Verify that plugin is working as expected -6. Install **target/allure-bamboo-plugin-VERSION.jar** manually as described [here](https://confluence.atlassian.com/display/UPM/Installing+add-ons#Installingadd-ons-Installingbyfileupload). +6. Install **target/allure-bamboo-plugin-VERSION.jar** manually as +described [here](https://confluence.atlassian.com/display/UPM/Installing+add-ons#Installingadd-ons-Installingbyfileupload). ### Configuration and Usage + Please follow the guide on the official Allure docs: https://docs.qameta.io/allure/#_bamboo diff --git a/pom.xml b/pom.xml index 1115e9f..54f89fd 100644 --- a/pom.xml +++ b/pom.xml @@ -234,6 +234,7 @@ ${spotless.version} UTF-8 + UNIX @@ -263,7 +264,7 @@ - ,jakarta,javax,java,\# + ,jakarta,javax,java,\# .mvn/quality-configs/spotless/allure.java.license diff --git a/src/main/java/io/qameta/allure/bamboo/AllureArtifactsManager.java b/src/main/java/io/qameta/allure/bamboo/AllureArtifactsManager.java index d1a2cb3..3ec29b5 100644 --- a/src/main/java/io/qameta/allure/bamboo/AllureArtifactsManager.java +++ b/src/main/java/io/qameta/allure/bamboo/AllureArtifactsManager.java @@ -147,7 +147,7 @@ Optional getArtifactUrl(final String planKeyString, .flatMap(rs -> getArtifactHandlerByClassName( fromCustomData(rs.getCustomBuildData()).getArtifactHandlerClass()) .map(handler -> getArtifactUrl(planKeyString, buildNumber, - filePath, artifactConfig, planResultKey, handler) + filePath, artifactConfig, planResultKey, handler) ) ); } @@ -164,10 +164,10 @@ private String getArtifactUrl(final String planKeyString, final ArtifactDefinitionContextImpl artifactDef = getAllureArtifactDef(); return Optional.ofNullable( - artifactHandler.getArtifactLinkDataProvider( - mutableArtifact(planResultKey, artifactDef.getName()), - configProvider(artifactConfig) - )) + artifactHandler.getArtifactLinkDataProvider( + mutableArtifact(planResultKey, artifactDef.getName()), + configProvider(artifactConfig) + )) .map(lp -> getArtifactUrl(filePath, planResultKey, artifactDef, lp)) .orElse(null); } @@ -326,19 +326,19 @@ Optional uploadReportArtifacts(final @NotNull ImmutableChain final String errorMessage = "Unable to publish artifact via " + artifactHandler; final ArtifactHandlerPublishingResult publishingResult = BambooPluginUtils.callUnsafeCode( new BambooPluginUtils.NoThrowCallable(errorMessage) { - @NotNull - @Override - public ArtifactHandlerPublishingResult call() { - try { - return artifactHandler.publish( - summary.getPlanResultKey(), artifact, artifactPublishingConfig); - } catch (final Exception e) { - LOGGER.error("Failed to publish Allure Report using handler " - + artifactHandler.getClass().getName(), e); - return ArtifactHandlerPublishingResultImpl.failure(); - } - } - }); + @NotNull + @Override + public ArtifactHandlerPublishingResult call() { + try { + return artifactHandler.publish( + summary.getPlanResultKey(), artifact, artifactPublishingConfig); + } catch (final Exception e) { + LOGGER.error("Failed to publish Allure Report using handler " + + artifactHandler.getClass().getName(), e); + return ArtifactHandlerPublishingResultImpl.failure(); + } + } + }); if (publishingResult != null) { publishingResult.setArtifactHandlerKey(artifactHandler.getModuleDescriptor().getCompleteKey()); return Optional.of(allureBuildResult(publishingResult.isSuccessful(), null) @@ -451,17 +451,17 @@ private Optional getArtifactHandlerByClassName(fi final AtomicReference>> predicate = new AtomicReference<>(); return Optional.ofNullable(className) .map(clazz -> { - final Class aClass; - try { - aClass = (Class) Class.forName(clazz); - predicate.set(new ModuleOfClassPredicate<>(aClass).and(new EnabledModulePredicate())); - - return pluginAccessor.getModules(predicate.get()).stream().findAny().orElse(null); - } catch (ClassNotFoundException e) { - LOGGER.error("Failed to find artifact handler for class name " + className, e); + final Class aClass; + try { + aClass = (Class) Class.forName(clazz); + predicate.set(new ModuleOfClassPredicate<>(aClass).and(new EnabledModulePredicate())); + + return pluginAccessor.getModules(predicate.get()).stream().findAny().orElse(null); + } catch (ClassNotFoundException e) { + LOGGER.error("Failed to find artifact handler for class name " + className, e); + } + return null; } - return null; - } ); } } diff --git a/src/main/java/io/qameta/allure/bamboo/AllureBuildCompleteAction.java b/src/main/java/io/qameta/allure/bamboo/AllureBuildCompleteAction.java index a8fac57..5ef2a1d 100644 --- a/src/main/java/io/qameta/allure/bamboo/AllureBuildCompleteAction.java +++ b/src/main/java/io/qameta/allure/bamboo/AllureBuildCompleteAction.java @@ -125,6 +125,9 @@ public void execute(final @NotNull ImmutableChain chain, final AllureExecutable allure = allureExecutable.provide(globalConfig, executable) .orElseThrow(() -> new RuntimeException("Failed to find Allure executable by name " + executable)); + // Creating a copy for customize report + final AllureExecutable allureTmp = allure.getCopy(); + LOGGER.info("Starting artifacts downloading into {} for {}", artifactsTempDir.getPath(), chain.getName()); final Collection artifactsPaths = artifactsManager.downloadAllArtifactsTo( chainResultsSummary, artifactsTempDir, buildConfig.getArtifactName()); @@ -137,9 +140,9 @@ public void execute(final @NotNull ImmutableChain chain, // Setting the new logo in the allure libraries before generate the report. if (globalConfig.isCustomLogoEnabled()) { - allure.setCustomLogo(buildConfig.getCustomLogoUrl()); + allureTmp.setCustomLogo(buildConfig.getCustomLogoUrl()); } - allure.generate(artifactsPaths, allureReportDir.toPath()); + allureTmp.generate(artifactsPaths, allureReportDir.toPath()); // Setting report name this.finalizeReport(allureReportDir, chainExecution.getPlanResultKey().getBuildNumber(), chain.getBuildName()); diff --git a/src/main/java/io/qameta/allure/bamboo/AllureBuildConfig.java b/src/main/java/io/qameta/allure/bamboo/AllureBuildConfig.java index eff78b2..8035cdb 100644 --- a/src/main/java/io/qameta/allure/bamboo/AllureBuildConfig.java +++ b/src/main/java/io/qameta/allure/bamboo/AllureBuildConfig.java @@ -16,7 +16,6 @@ package io.qameta.allure.bamboo; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.validator.routines.UrlValidator; import javax.annotation.Nullable; import java.io.Serializable; @@ -49,9 +48,7 @@ private AllureBuildConfig(final String executable, this.enabled = StringUtils.isEmpty(enabled) ? FALSE : Boolean.parseBoolean(enabled); this.executable = executable; this.artifactName = artifactName; - // If the URL is not a valid URL it will be omitted - final UrlValidator urlValidator = new UrlValidator(); - this.logoUrl = urlValidator.isValid(logoUrl) ? logoUrl : AllureBuildConfig.DEFAULT_CUSTOM_LOGO_URL; + this.logoUrl = !logoUrl.isEmpty() ? logoUrl : AllureBuildConfig.DEFAULT_CUSTOM_LOGO_URL; } static AllureBuildConfig fromContext(final Map context) { diff --git a/src/main/java/io/qameta/allure/bamboo/AllureDownloader.java b/src/main/java/io/qameta/allure/bamboo/AllureDownloader.java index 4f5a8a7..9b9d353 100644 --- a/src/main/java/io/qameta/allure/bamboo/AllureDownloader.java +++ b/src/main/java/io/qameta/allure/bamboo/AllureDownloader.java @@ -79,8 +79,8 @@ private Optional downloadAllure(final String version) { return Downloader.download(url, downloadToFile); } catch (Exception e) { LOGGER - .warn("Failed to download from {}. Root cause : {}.", - url, e.toString()); + .warn("Failed to download from {}. Root cause : {}.", + url, e.toString()); } } } catch (Exception e) { @@ -91,11 +91,11 @@ private Optional downloadAllure(final String version) { private URL[] buildAllureDownloadUrls(final String version) throws MalformedURLException { final URL gitUrl = fromPath(settingsManager.getSettings().getDownloadBaseUrl()) - .path(String.format("%s/allure-%s.zip", version, version)) - .build().toURL(); + .path(String.format("%s/allure-%s.zip", version, version)) + .build().toURL(); final URL mavenUrl = fromPath(settingsManager.getSettings().getDownloadCliBaseUrl()) - .path(String.format("allure-commandline/%s/allure-commandline-%s.zip", version, version)) - .build().toURL(); + .path(String.format("allure-commandline/%s/allure-commandline-%s.zip", version, version)) + .build().toURL(); return new URL[]{gitUrl, mavenUrl}; } } diff --git a/src/main/java/io/qameta/allure/bamboo/AllureExecutable.java b/src/main/java/io/qameta/allure/bamboo/AllureExecutable.java index b23a993..c2e38d8 100644 --- a/src/main/java/io/qameta/allure/bamboo/AllureExecutable.java +++ b/src/main/java/io/qameta/allure/bamboo/AllureExecutable.java @@ -25,15 +25,15 @@ import javax.annotation.Nonnull; import java.io.File; import java.io.IOException; -import java.net.URL; import java.nio.file.Path; import java.util.Collection; import java.util.LinkedList; import java.util.regex.Pattern; +import static java.nio.file.Files.createTempDirectory; import static java.util.Arrays.asList; import static java.util.stream.Collectors.toList; -import static javax.ws.rs.core.UriBuilder.fromPath; +import static org.apache.commons.io.FileUtils.copyDirectoryToDirectory; class AllureExecutable { @@ -87,11 +87,10 @@ public void setCustomLogo(final String logoUrl) { objectMapper.writeValue(configFile, ap); } //Setting new Logo - final URL srcLogoUrl = fromPath(logoUrl).build().toURL(); FileStringReplacer.replaceInFile(logoPluginFolder.resolve(cssFileName), Pattern.compile("url\\('.+'\\)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.COMMENTS), - "url(" + srcLogoUrl.toString() + ")" + "url(" + logoUrl + ")" ); // aligning logo to center @@ -100,6 +99,12 @@ public void setCustomLogo(final String logoUrl) { Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.COMMENTS), "center" ); + // fit logo to area + FileStringReplacer.replaceInFile(logoPluginFolder.resolve(cssFileName), + Pattern.compile("(?<=\\s )!important;", + Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.COMMENTS), + "!important; background-size: contain !important;" + ); // removing margin FileStringReplacer.replaceInFile(logoPluginFolder.resolve(cssFileName), Pattern.compile("10px", @@ -113,6 +118,22 @@ public void setCustomLogo(final String logoUrl) { } } + public AllureExecutable getCopy() throws IOException { + final String binary = this.cmdPath.getFileName().toString(); + final String binFolder = this.cmdPath.getParent().getFileName().toString(); + final Path rootPath = this.cmdPath.getParent().getParent(); + final Path rootFolderName = rootPath.getFileName(); + final Path copyPath = createTempDirectory(rootFolderName.toString()); + copyDirectoryToDirectory(rootPath.toFile(), copyPath.toFile()); + + return new AllureExecutable(copyPath + .resolve(rootFolderName.toString()) + .resolve(binFolder) + .resolve(binary), + this.cmdLine + ); + } + Path getCmdPath() { return cmdPath; } diff --git a/src/main/java/io/qameta/allure/bamboo/AllureExecutableProvider.java b/src/main/java/io/qameta/allure/bamboo/AllureExecutableProvider.java index 730b236..88d7a3c 100644 --- a/src/main/java/io/qameta/allure/bamboo/AllureExecutableProvider.java +++ b/src/main/java/io/qameta/allure/bamboo/AllureExecutableProvider.java @@ -70,7 +70,7 @@ Optional provide(final boolean isDownloadEnabled, final String } else if (isDownloadEnabled) { final Matcher nameMatcher = EXEC_NAME_PATTERN.matcher(executableName); return allureDownloader.downloadAndExtractAllureTo(allureHomeSubDir, - nameMatcher.matches() ? nameMatcher.group(1) : DEFAULT_VERSION) + nameMatcher.matches() ? nameMatcher.group(1) : DEFAULT_VERSION) .map(path -> executable).orElse(null); } return null; diff --git a/src/main/java/io/qameta/allure/bamboo/AllureReportServlet.java b/src/main/java/io/qameta/allure/bamboo/AllureReportServlet.java index f3a2f9d..cfa0a2b 100644 --- a/src/main/java/io/qameta/allure/bamboo/AllureReportServlet.java +++ b/src/main/java/io/qameta/allure/bamboo/AllureReportServlet.java @@ -100,7 +100,7 @@ private void setResponseHeaders(final HttpServletResponse response, final URI file = new URL(fileUrl).toURI(); final String mimeType = Optional.ofNullable(getServletContext().getMimeType(fileUrl)) .orElse(Files.probeContentType(Paths.get(file.getPath())) - ); + ); final String charsetPostfix = Stream.of("application", "text") .anyMatch(mimeType::contains) ? ";charset=utf-8" : ""; response.setHeader(CONTENT_TYPE, mimeType + charsetPostfix); @@ -152,7 +152,7 @@ private void uploadResultWasNotSuccess(final HttpServletResponse response, final String errorMessage = isEmpty(uploadResult.getFailureDetails()) ? "Unknown error has occurred during Allure Build. Please refer the server logs for details." : "Something went wrong with Allure Report generation. Here are some details: \n" - + uploadResult.getFailureDetails(); + + uploadResult.getFailureDetails(); try { response.setHeader(CONTENT_TYPE, "text/plain"); response.setHeader("Content-Length", String.valueOf(errorMessage.length())); diff --git a/src/main/java/io/qameta/allure/bamboo/BambooExecutablesManager.java b/src/main/java/io/qameta/allure/bamboo/BambooExecutablesManager.java index 0fd3a53..74b18ac 100644 --- a/src/main/java/io/qameta/allure/bamboo/BambooExecutablesManager.java +++ b/src/main/java/io/qameta/allure/bamboo/BambooExecutablesManager.java @@ -84,7 +84,7 @@ void addDefaultAllureExecutableCapability() { final CapabilityImpl capability = new CapabilityImpl(key, DEFAULT_PATH); capSet.addCapability(capability); capabilitySetManager.saveCapabilitySet(capSet); - }); + }); } @NotNull diff --git a/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Statistic.java b/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Statistic.java index 3f93f90..af7a232 100644 --- a/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Statistic.java +++ b/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Statistic.java @@ -43,7 +43,6 @@ public class Statistic extends AbstractSummary { /** * No args constructor for use in serialization. - * */ public Statistic() { // empty diff --git a/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Summary.java b/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Summary.java index f7a52de..81bc87c 100644 --- a/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Summary.java +++ b/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Summary.java @@ -45,10 +45,10 @@ public Summary() { } /** - * @param statistic statistic + * @param statistic statistic * @param reportName report name - * @param time time - * @param testRuns test runs + * @param time time + * @param testRuns test runs */ public Summary(final String reportName, final List testRuns, diff --git a/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Time.java b/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Time.java index 85b63f1..1f01673 100644 --- a/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Time.java +++ b/src/main/java/io/qameta/allure/bamboo/info/allurewidgets/summary/Time.java @@ -49,11 +49,11 @@ public Time() { } /** - * @param duration duration + * @param duration duration * @param sumDuration sum of duration * @param minDuration min duration - * @param stop stop time - * @param start start time + * @param stop stop time + * @param start start time * @param maxDuration max duration */ public Time(final Long start, diff --git a/src/main/java/io/qameta/allure/bamboo/util/Downloader.java b/src/main/java/io/qameta/allure/bamboo/util/Downloader.java index 45b54a0..5132f5d 100644 --- a/src/main/java/io/qameta/allure/bamboo/util/Downloader.java +++ b/src/main/java/io/qameta/allure/bamboo/util/Downloader.java @@ -41,16 +41,16 @@ private Downloader() { public static Optional download(final URL url, final Path target) throws IOException { - final URLConnection connection = url.openConnection(); - connection.setConnectTimeout(CONN_TIMEOUT_MS); - connection.setReadTimeout(DOWNLOAD_TIMEOUT_MS); - connection.setRequestProperty("Connection", "close"); - connection.setRequestProperty("Pragma", "no-cache"); - ((HttpURLConnection) connection).setInstanceFollowRedirects(true); - connection.connect(); - try (InputStream input = connection.getInputStream()) { - Files.copy(input, target, StandardCopyOption.REPLACE_EXISTING); - return Optional.of(target); - } + final URLConnection connection = url.openConnection(); + connection.setConnectTimeout(CONN_TIMEOUT_MS); + connection.setReadTimeout(DOWNLOAD_TIMEOUT_MS); + connection.setRequestProperty("Connection", "close"); + connection.setRequestProperty("Pragma", "no-cache"); + ((HttpURLConnection) connection).setInstanceFollowRedirects(true); + connection.connect(); + try (InputStream input = connection.getInputStream()) { + Files.copy(input, target, StandardCopyOption.REPLACE_EXISTING); + return Optional.of(target); + } } } diff --git a/src/main/resources/allure-bamboo.properties b/src/main/resources/allure-bamboo.properties index 3fe8750..8382a79 100644 --- a/src/main/resources/allure-bamboo.properties +++ b/src/main/resources/allure-bamboo.properties @@ -1,32 +1,28 @@ -allureplugin.policy = Generate Report -allureplugin.policy.description = Choose condition when report should be built -allureplugin.policy.error = Select for which builds to generate report -allureplugin.policy.all = For all builds -allureplugin.policy.with_problems = For builds with problems -allureplugin.policy.failed = For failed builds - -allure.result.directory.label = Allure result directory -allure.result.directory.description = Specify the directory with allure results relative from build directory. \ +allureplugin.policy=Generate Report +allureplugin.policy.description=Choose condition when report should be built +allureplugin.policy.error=Select for which builds to generate report +allureplugin.policy.all=For all builds +allureplugin.policy.with_problems=For builds with problems +allureplugin.policy.failed=For failed builds +allure.result.directory.label=Allure result directory +allure.result.directory.description=Specify the directory with allure results relative from build directory. \ An example allure-results/ -allure.report.path.prefix.label = Report artifact subdirectory -allure.report.path.prefix.description = The subdirectory (or subdirectories) to put generated report into. \ +allure.report.path.prefix.label=Report artifact subdirectory +allure.report.path.prefix.description=The subdirectory (or subdirectories) to put generated report into. \ An example allure-report/ -allure.issues.tracker.pattern.label = Issue tracker pattern -allure.issues.tracker.pattern.description = \ +allure.issues.tracker.pattern.label=Issue tracker pattern +allure.issues.tracker.pattern.description=\ Specify the issue tracker pattern. E.g. http://bugtracker.yourcompany.com/issues/%s \ For more information you can see this wiki page. -allure.tests.management.pattern.label = Test management pattern -allure.tests.management.pattern.description = \ +allure.tests.management.pattern.label=Test management pattern +allure.tests.management.pattern.description=\ Specify the test management system pattern. E.g. http://tms.yourcompany.com/tests/%s \ For more information you can see this wiki page. - -allure.task.help.link = https://docs.qameta.io/allure/latest/#_bamboo -allure.task.help.title = Go to Allure website! - -error.property.empty = The property value should not be empty -error.path.absolute = The path should be relative -error.address.placeholder = The pattern should contain exactly one placeholder <%s> - +allure.task.help.link=https://docs.qameta.io/allure/latest/#_bamboo +allure.task.help.title=Go to Allure website! +error.property.empty=The property value should not be empty +error.path.absolute=The path should be relative +error.address.placeholder=The pattern should contain exactly one placeholder <%s> webitems.system.admin.build.allureReport=Allure Report admin.allureReportConfig.edit.title=Configure Allure Reporting admin.allureReportConfig.description= @@ -44,6 +40,5 @@ allure.config.local.storage.label=Allure local storage allure.config.local.storage.label.required=Allure local storage is required build.allure.title=Allure Report buildResult.allure.title=Allure Report - allure.config.logo.enabled.label=Enable report custom logo -custom.allure.logo.url.label=Custom logo URL (svg) +custom.allure.logo.url.label=Custom logo diff --git a/src/main/resources/templates/editAllureBambooConfiguration.ftl b/src/main/resources/templates/editAllureBambooConfiguration.ftl index a4bbe48..a0ab169 100644 --- a/src/main/resources/templates/editAllureBambooConfiguration.ftl +++ b/src/main/resources/templates/editAllureBambooConfiguration.ftl @@ -9,6 +9,6 @@ [@ww.textfield labelKey="custom.allure.artifact.name.label" name="custom.allure.artifact.name" required="false"/] - [@ww.textfield labelKey="custom.allure.logo.url.label" name="custom.allure.logo.url" required="false"/] + [@ww.textarea labelKey="custom.allure.logo.url.label" name="custom.allure.logo.url" required="false"/] -[/@ui.bambooSection] \ No newline at end of file +[/@ui.bambooSection] diff --git a/src/main/resources/templates/editAllureReportConfig.ftl b/src/main/resources/templates/editAllureReportConfig.ftl index f93e505..8b9ff1a 100644 --- a/src/main/resources/templates/editAllureReportConfig.ftl +++ b/src/main/resources/templates/editAllureReportConfig.ftl @@ -3,30 +3,30 @@ - [@ww.text name='allure.plugin.title' /] + [@ww.text name='allure.plugin.title' /] -

[@ww.text name='allure.plugin.title' /]

+

[@ww.text name='allure.plugin.title' /]

-

[@ww.text name='admin.allureReportConfig.description' /]

+

[@ww.text name='admin.allureReportConfig.description' /]

- [@ww.form action="saveAllureReportConfig" - id="saveAllureReportConfigForm" - submitLabelKey='global.buttons.update' - titleKey='admin.allureReportConfig.edit.title' - cancelUri='/admin/editAllureReportConfig.action' - ] - [@ww.checkbox labelKey='allure.config.download.enabled.label' name='custom.allure.config.download.enabled' toggle='true' /] +[@ww.form action="saveAllureReportConfig" +id="saveAllureReportConfigForm" +submitLabelKey='global.buttons.update' +titleKey='admin.allureReportConfig.edit.title' +cancelUri='/admin/editAllureReportConfig.action' +] + [@ww.checkbox labelKey='allure.config.download.enabled.label' name='custom.allure.config.download.enabled' toggle='true' /] - [@ww.checkbox labelKey='allure.config.logo.enabled.label' name='custom.allure.config.logo.enabled' toggle='true' /] + [@ww.checkbox labelKey='allure.config.logo.enabled.label' name='custom.allure.config.logo.enabled' toggle='true' /] - [@ww.checkbox labelKey='allure.config.enabled.default.label' name='custom.allure.config.enabled.default' toggle='true' /] + [@ww.checkbox labelKey='allure.config.enabled.default.label' name='custom.allure.config.enabled.default' toggle='true' /] - [@ww.textfield labelKey="allure.config.download.url.label" name="custom.allure.config.download.url" required="true"/] + [@ww.textfield labelKey="allure.config.download.url.label" name="custom.allure.config.download.url" required="true"/] - [@ww.textfield labelKey="allure.config.local.storage.label" name="custom.allure.config.local.storage" required="true"/] - [/@ww.form] + [@ww.textfield labelKey="allure.config.local.storage.label" name="custom.allure.config.local.storage" required="true"/] +[/@ww.form] - \ No newline at end of file + diff --git a/src/main/resources/templates/error.ftl b/src/main/resources/templates/error.ftl index bf3bb18..198de7d 100644 --- a/src/main/resources/templates/error.ftl +++ b/src/main/resources/templates/error.ftl @@ -3,19 +3,19 @@ - [@ww.text name='error.title' /] + [@ww.text name='error.title' /] - [@ui.header pageKey='error.heading' /] +[@ui.header pageKey='error.heading' /] - [#if formattedActionErrors?has_content] - [@ui.messageBox type='warning'] - [#list formattedActionErrors as error] -

${error}

- [/#list] - [/@ui.messageBox] - [/#if] +[#if formattedActionErrors?has_content] + [@ui.messageBox type='warning'] + [#list formattedActionErrors as error] +

${error}

+ [/#list] + [/@ui.messageBox] +[/#if] - \ No newline at end of file + diff --git a/src/main/resources/templates/viewAllureReport.ftl b/src/main/resources/templates/viewAllureReport.ftl index 281b6ea..3ee3500 100644 --- a/src/main/resources/templates/viewAllureReport.ftl +++ b/src/main/resources/templates/viewAllureReport.ftl @@ -1,19 +1,19 @@ [#-- @ftlvariable name="" type="io.qameta.allure.bamboo.ViewAllureReport" --] -[#assign reportUrl = "${baseUrl}/plugins/servlet/allure/report/${planKey}/${buildNumber}/"] -[#assign reportZipUrl = "${baseUrl}/plugins/servlet/allure/report/${planKey}/${buildNumber}/report.zip"] -[@ui.header pageKey='buildResult.changes.title' object='${immutablePlan.name} ${resultsSummary.buildNumber}' title=true/] + [#assign reportUrl = "${baseUrl}/plugins/servlet/allure/report/${planKey}/${buildNumber}/"] + [#assign reportZipUrl = "${baseUrl}/plugins/servlet/allure/report/${planKey}/${buildNumber}/report.zip"] + [@ui.header pageKey='buildResult.changes.title' object='${immutablePlan.name} ${resultsSummary.buildNumber}' title=true/]