Source:
<code>public void perform(Run<?,?> build, FilePath ws, EnvVars environment, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { if(artifacts.length()==0) { throw new AbortException(Messages.ArtifactArchiver_NoIncludes()); } Result result = build.getResult(); if (onlyIfSuccessful && result != null && result.isWorseThan(Result.UNSTABLE)) { listener.getLogger().println(Messages.ArtifactArchiver_SkipBecauseOnlyIfSuccessful()); return; } listener.getLogger().println(Messages.ArtifactArchiver_ARCHIVING_ARTIFACTS()); try { String artifacts = this.artifacts; <START> if (build instanceof AbstractBuild) artifacts = environment.expand(artifacts); <END> Map<String,String> files = ws.act(new ListFiles(artifacts, excludes, defaultExcludes, caseSensitive, followSymlinks)); if (!files.isEmpty()) { build.pickArtifactManager().archive(ws, launcher, BuildListenerAdapter.wrap(listener), files); if (fingerprint) { Fingerprinter f = new Fingerprinter(artifacts); f.setExcludes(excludes); f.setDefaultExcludes(defaultExcludes); f.setCaseSensitive(caseSensitive); f.perform(build, ws, launcher, listener); } } else { result = build.getResult(); if (result == null || result.isBetterOrEqualTo(Result.UNSTABLE)) { try { String msg = ws.validateAntFileMask(artifacts, FilePath.VALIDATE_ANT_FILE_MASK_BOUND, caseSensitive); if (msg != null) { listener.getLogger().println(msg); } } catch (Exception e) { Functions.printStackTrace(e, listener.getLogger()); } if (allowEmptyArchive) { listener.getLogger().println(Messages.ArtifactArchiver_NoMatchFound(artifacts)); } else { throw new AbortException(Messages.ArtifactArchiver_NoMatchFound(artifacts)); } } else { } } } catch (java.nio.file.AccessDeniedException e) { LOG.log(Level.FINE, "Diagnosing anticipated Exception", e); throw new AbortException(e.toString()); } }</code><technical_language>suggestion if (build instanceof AbstractBuild) { // expansion in pipelines artifacts = environment.expand(artifacts); }</technical_language>

Target:
public void perform(Run<?,?> build, FilePath ws, EnvVars environment, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { if(artifacts.length()==0) { throw new AbortException(Messages.ArtifactArchiver_NoIncludes()); } Result result = build.getResult(); if (onlyIfSuccessful && result != null && result.isWorseThan(Result.UNSTABLE)) { listener.getLogger().println(Messages.ArtifactArchiver_SkipBecauseOnlyIfSuccessful()); return; } listener.getLogger().println(Messages.ArtifactArchiver_ARCHIVING_ARTIFACTS()); try { String artifacts = this.artifacts; if (build instanceof AbstractBuild) { artifacts = environment.expand(artifacts); } Map<String,String> files = ws.act(new ListFiles(artifacts, excludes, defaultExcludes, caseSensitive, followSymlinks)); if (!files.isEmpty()) { build.pickArtifactManager().archive(ws, launcher, BuildListenerAdapter.wrap(listener), files); if (fingerprint) { Fingerprinter f = new Fingerprinter(artifacts); f.setExcludes(excludes); f.setDefaultExcludes(defaultExcludes); f.setCaseSensitive(caseSensitive); f.perform(build, ws, launcher, listener); } } else { result = build.getResult(); if (result == null || result.isBetterOrEqualTo(Result.UNSTABLE)) { try { String msg = ws.validateAntFileMask(artifacts, FilePath.VALIDATE_ANT_FILE_MASK_BOUND, caseSensitive); if (msg != null) { listener.getLogger().println(msg); } } catch (Exception e) { Functions.printStackTrace(e, listener.getLogger()); } if (allowEmptyArchive) { listener.getLogger().println(Messages.ArtifactArchiver_NoMatchFound(artifacts)); } else { throw new AbortException(Messages.ArtifactArchiver_NoMatchFound(artifacts)); } } else { } } } catch (java.nio.file.AccessDeniedException e) { LOG.log(Level.FINE, "Diagnosing anticipated Exception", e); throw new AbortException(e.toString()); } }