/** * @deprecated as of 1.305 use {@link #getEnvironment(TaskListener)} */ @Deprecated public EnvVars getEnvironment() throws IOException, InterruptedException { LOGGER.log(WARNING, "deprecated call to Run.getEnvironment\n\tat {0}", new Throwable().getStackTrace()[1]); return getEnvironment(new LogTaskListener(LOGGER, Level.INFO)); }
/** * @deprecated as of 1.292 * Use {@link #getEnvironment(TaskListener)} instead. */ @Deprecated public Map<String,String> getEnvVars() { LOGGER.log(WARNING, "deprecated call to Run.getEnvVars\n\tat {0}", new Throwable().getStackTrace()[1]); try { return getEnvironment(new LogTaskListener(LOGGER, Level.INFO)); } catch (IOException e) { return new EnvVars(); } catch (InterruptedException e) { return new EnvVars(); } }
private static Map<String, String> getEnvVars(Run<?, ?> build, TaskListener listener) { Map<String, String> messageEnvVars = new HashMap<>(); if (build != null) { messageEnvVars.putAll(build.getCharacteristicEnvVars()); try { messageEnvVars.putAll(build.getEnvironment(listener)); } catch (Exception e) { listener.getLogger().printf("Couldn't get Env Variables: %s%n", e.getMessage()); LOGGER.log(Level.WARNING, "Couldn't get Env Variables", e); } } return messageEnvVars; }
@Override public void perform(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException { try { listener.getLogger().println(Messages.Fingerprinter_Recording()); Map<String,String> record = new HashMap<String,String>(); EnvVars environment = build.getEnvironment(listener); if(targets.length()!=0) { String expandedTargets = environment.expand(targets); record(build, workspace, listener, record, expandedTargets); } FingerprintAction fingerprintAction = build.getAction(FingerprintAction.class); if (fingerprintAction != null) { fingerprintAction.add(record); } else { build.addAction(new FingerprintAction(build,record)); } if (enableFingerprintsInDependencyGraph) { Jenkins.getInstance().rebuildDependencyGraphAsync(); } } catch (IOException e) { Functions.printStackTrace(e, listener.error(Messages.Fingerprinter_Failed())); build.setResult(Result.FAILURE); } // failing to record fingerprints is an error but not fatal }
String artifacts = build.getEnvironment(listener).expand(this.artifacts);
@Override public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedException { EnvVars env = super.getEnvironment(log); FilePath ws = getWorkspace(); if (ws!=null) // if this is done very early on in the build, workspace may not be decided yet. see HUDSON-3997 env.put("WORKSPACE", ws.getRemote()); project.getScm().buildEnvVars(this,env); if (buildEnvironments!=null) for (Environment e : buildEnvironments) e.buildEnvVars(env); for (EnvironmentContributingAction a : getActions(EnvironmentContributingAction.class)) a.buildEnvVars(this,env); EnvVars.resolve(env); return env; }
gitLabBranchBuilds = retrieveGitlabProjectIds(build, build.getEnvironment(listener)); } catch (IOException | InterruptedException e) { printf(listener, "Failed to get Gitlab Build list to update status: %s%n", e.getMessage());
public AbstractBuildInfoDeployer(BuildInfoAwareConfigurator configurator, Run build, TaskListener listener, ArtifactoryBuildInfoClient client) throws IOException, InterruptedException { this.configurator = configurator; this.build = build; this.listener = listener; this.client = client; this.env = build.getEnvironment(listener); }
/** * @deprecated as of 1.305 use {@link #getEnvironment(TaskListener)} */ @Deprecated public EnvVars getEnvironment() throws IOException, InterruptedException { LOGGER.log(WARNING, "deprecated call to Run.getEnvironment\n\tat {0}", new Throwable().getStackTrace()[1]); return getEnvironment(new LogTaskListener(LOGGER, Level.INFO)); }
/** * @deprecated as of 1.305 use {@link #getEnvironment(TaskListener)} */ public EnvVars getEnvironment() throws IOException, InterruptedException { return getEnvironment(new LogTaskListener(LOGGER, Level.INFO)); }
/** * @deprecated as of 1.305 use {@link #getEnvironment(TaskListener)} */ public EnvVars getEnvironment() throws IOException, InterruptedException { return getEnvironment(new LogTaskListener(LOGGER, Level.INFO)); }
/** * @deprecated as of 1.305 use {@link #getEnvironment(TaskListener)} */ public EnvVars getEnvironment() throws IOException, InterruptedException { return getEnvironment(new LogTaskListener(LOGGER, Level.INFO)); }
/** * @deprecated as of 1.305 use {@link #getEnvironment(TaskListener)} */ public EnvVars getEnvironment() throws IOException, InterruptedException { return getEnvironment(new LogTaskListener(LOGGER, Level.INFO)); }
private String getExpandedResolvedPattern(TestType tool, Run<?, ?> build, TaskListener listener) throws IOException, InterruptedException { String newExpandedPattern = tool.getPattern(); newExpandedPattern = newExpandedPattern.replaceAll("[\t\r\n]+", " "); return Util.replaceMacro(newExpandedPattern, build.getEnvironment(listener)); }
/** * @deprecated as of 1.292 Use {@link #getEnvironment()} instead. */ public Map<String, String> getEnvVars() { try { return getEnvironment(); } catch (IOException e) { return new EnvVars(); } catch (InterruptedException e) { return new EnvVars(); } }
private String expandPattern(final Run<?, ?> run, final String actualPattern) { try { EnvironmentResolver environmentResolver = new EnvironmentResolver(); return environmentResolver.expandEnvironmentVariables( run.getEnvironment(TaskListener.NULL), actualPattern); } catch (IOException | InterruptedException ignore) { return actualPattern; // fallback, no expansion } }
/** * @deprecated as of 1.292 * Use {@link #getEnvironment()} instead. */ public Map<String,String> getEnvVars() { try { return getEnvironment(); } catch (IOException e) { return new EnvVars(); } catch (InterruptedException e) { return new EnvVars(); } }
/** * Get environment vars of the run, with all values overridden by build vars */ public static EnvVars getEnvAndBuildVars(Run<?, ?> run, TaskListener listener) throws IOException, InterruptedException { EnvVars env = run.getEnvironment(listener); if (run instanceof AbstractBuild) { env.overrideAll(((AbstractBuild<?, ?>) run).getBuildVariables()); } return env; }
@Override public EnvVars getEnvironment() throws IOException, InterruptedException { initPython(); if (pexec.isImplemented(79)) { return (EnvVars) pexec.execPython("get_environment"); } else { return super.getEnvironment(); } }
@Override public EnvVars getEnvironment(TaskListener listener) throws IOException, InterruptedException { initPython(); if (pexec.isImplemented(80)) { return (EnvVars) pexec.execPython("get_environment", listener); } else { return super.getEnvironment(listener); } }