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 environment variables resolution #371

Merged
merged 2 commits into from
Nov 20, 2024
Merged
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 @@ -247,6 +247,7 @@ public AllureReportPublisherDescriptor getDescriptor() {
@Override
public void perform(final @NonNull Run<?, ?> run,
final @NonNull FilePath workspace,
final @NonNull EnvVars env,
final @NonNull Launcher launcher,
final @NonNull TaskListener listener) throws InterruptedException, IOException {
if (isDisabled()) {
Expand All @@ -260,13 +261,13 @@ public void perform(final @NonNull Run<?, ?> run,
+ " Check your job's configuration.");
}
final List<FilePath> results = new ArrayList<>();
final EnvVars buildEnvVars = BuildUtils.getBuildEnvVars(run, listener);

for (final ResultsConfig resultsConfig : resultsConfigs) {
final String expandedPath = buildEnvVars.expand(resultsConfig.getPath());
final String expandedPath = env.expand(resultsConfig.getPath());
results.addAll(workspace.act(new FindByGlob(expandedPath)));
}
prepareResults(results, run, workspace, listener);
generateReport(results, run, workspace, launcher, listener);
generateReport(results, run, workspace, env, launcher, listener);
copyResultsToParentIfNeeded(results, run, listener);
}

Expand Down Expand Up @@ -318,7 +319,9 @@ public boolean endBuild() throws InterruptedException, IOException {
resultsPaths.add(directory);
}
}
generateReport(resultsPaths, build, workspace, launcher, listener);

final EnvVars buildEnvVars = BuildUtils.getBuildEnvVars(build, listener);
generateReport(resultsPaths, build, workspace, buildEnvVars, launcher, listener);
for (FilePath resultsPath : resultsPaths) {
FilePathUtils.deleteRecursive(resultsPath, listener.getLogger());
}
Expand All @@ -331,6 +334,7 @@ public boolean endBuild() throws InterruptedException, IOException {
private void generateReport(final @NonNull List<FilePath> resultsPaths,
final @NonNull Run<?, ?> run,
final @NonNull FilePath workspace,
final @NonNull EnvVars env,
final @NonNull Launcher launcher,
final @NonNull TaskListener listener
) throws IOException, InterruptedException { //NOSONAR
Expand All @@ -342,13 +346,13 @@ private void generateReport(final @NonNull List<FilePath> resultsPaths,
return;
}

final EnvVars buildEnvVars = BuildUtils.getBuildEnvVars(run, listener);
setAllureProperties(buildEnvVars);
configureJdk(launcher, listener, buildEnvVars);
final AllureCommandlineInstallation commandline = getCommandline(launcher, listener, buildEnvVars);

setAllureProperties(env);
configureJdk(launcher, listener, env);
final AllureCommandlineInstallation commandline = getCommandline(launcher, listener, env);

final FilePath reportPath = workspace.child(getReport());
final ReportBuilder builder = new ReportBuilder(launcher, listener, workspace, buildEnvVars, commandline);
final ReportBuilder builder = new ReportBuilder(launcher, listener, workspace, env, commandline);
if (getConfigPath() != null && workspace.child(getConfigPath()).exists()) {
final FilePath configFilePath = workspace.child(getConfigPath()).absolutize();
listener.getLogger().println("Allure config file: " + configFilePath.absolutize());
Expand Down
Loading