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

fix: Calling allure step multiple times in one build causes errors #346

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ private void generateReport(final @Nonnull List<FilePath> resultsPaths,
final AllureReportBuildAction buildAction = new AllureReportBuildAction(
FilePathUtils.extractSummary(run, reportPath.getName()));
buildAction.setReportPath(reportPath);
run.addAction(buildAction);
// run.addAction(buildAction);
// change to below. Calling allure multiple times would produce many allure icons
run.addOrReplaceAction(buildAction);
run.setResult(buildAction.getBuildSummary().getResult());
}

Expand All @@ -383,7 +385,10 @@ private void saveAllureArtifact(final Run<?, ?> run,
Objects.requireNonNull(reportPath.getParent())
.archive(TrueZipArchiver.FACTORY, os, reportPath.getName() + "/**");
}

if (archive.exists() && !archive.delete()) {
listener.getLogger().println("Artifact already exists but unable to be deleted");
return;
}
Files.move(tempArchive.toPath(), archive.toPath());
listener.getLogger().println("Artifact was added to the build.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static void deleteRecursive(final FilePath filePath,
public static FilePath getPreviousReportWithHistory(final Run<?, ?> run,
final String reportPath)
throws IOException, InterruptedException {
Run<?, ?> current = run;
Run<?, ?> current = run.getPreviousCompletedBuild();
while (current != null) {
final FilePath previousReport = new FilePath(current.getArtifactsDir()).child(ALLURE_REPORT_ZIP);
if (previousReport.exists() && isHistoryNotEmpty(previousReport, reportPath)) {
Expand Down