Skip to content
Permalink
Browse files

Merge pull request #3265 from jglick/simple-build-steps-should-be-sim…

…ple-JENKINS-47142

[JENKINS-47142] Simplifying the logic of ArtifactArchiver.perform, making it friendlier to Pipeline
  • Loading branch information
oleg-nenashev committed Feb 16, 2018
2 parents b4dc448 + 193855d commit e5fd7b7c90077e681454723bb952acc7067e4443
@@ -2441,7 +2441,7 @@ public String validateAntFileMask(final String fileMasks, final int bound) throw
* @throws InterruptedException not only in case of a channel failure, but also if too many operations were performed without finding any matches
* @since 1.484
*/
public String validateAntFileMask(final String fileMasks, final int bound, final boolean caseSensitive) throws IOException, InterruptedException {
public @CheckForNull String validateAntFileMask(final String fileMasks, final int bound, final boolean caseSensitive) throws IOException, InterruptedException {
return act(new MasterToSlaveFileCallable<String>() {
private static final long serialVersionUID = 1;
public String invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException {
@@ -214,20 +214,10 @@ public boolean isCaseSensitive() {
this.caseSensitive = caseSensitive;
}

private void listenerWarnOrError(TaskListener listener, String message) {
if (allowEmptyArchive) {
listener.getLogger().println(String.format("WARN: %s", message));
} else {
listener.error(message);
}
}

@Override
public void perform(Run<?,?> build, FilePath ws, Launcher launcher, TaskListener listener) throws InterruptedException, AbortException {
public void perform(Run<?,?> build, FilePath ws, Launcher launcher, TaskListener listener) throws IOException, InterruptedException {
if(artifacts.length()==0) {
listener.error(Messages.ArtifactArchiver_NoIncludes());
build.setResult(Result.FAILURE);
return;
throw new AbortException(Messages.ArtifactArchiver_NoIncludes());
}

Result result = build.getResult();
@@ -249,29 +239,29 @@ public void perform(Run<?,?> build, FilePath ws, Launcher launcher, TaskListener
} else {
result = build.getResult();
if (result == null || result.isBetterOrEqualTo(Result.UNSTABLE)) {
// If the build failed, don't complain that there was no matching artifact.
// The build probably didn't even get to the point where it produces artifacts.
listenerWarnOrError(listener, Messages.ArtifactArchiver_NoMatchFound(artifacts));
String msg = null;
try {
msg = ws.validateAntFileMask(artifacts, FilePath.VALIDATE_ANT_FILE_MASK_BOUND, caseSensitive);
String msg = ws.validateAntFileMask(artifacts, FilePath.VALIDATE_ANT_FILE_MASK_BOUND, caseSensitive);
if (msg != null) {
listener.getLogger().println(msg);
}
} catch (Exception e) {
listenerWarnOrError(listener, e.getMessage());
Functions.printStackTrace(e, listener.getLogger());
}
if(msg!=null)
listenerWarnOrError(listener, msg);
}
if (!allowEmptyArchive) {
build.setResult(Result.FAILURE);
if (allowEmptyArchive) {
listener.getLogger().println(Messages.ArtifactArchiver_NoMatchFound(artifacts));
} else {
throw new AbortException(Messages.ArtifactArchiver_NoMatchFound(artifacts));
}
} else {
// If a freestyle build failed, do not complain that there was no matching artifact:
// the build probably did not even get to the point where it produces artifacts.
// For Pipeline, the program ought not be *trying* to archive anything after a failure,
// but anyway most likely result == null above so we would not be here.
}
}
} catch (java.nio.file.AccessDeniedException e) {
LOG.log(Level.FINE, "Diagnosing anticipated Exception", e);
throw new AbortException(e.toString()); // Message is not enough as that is the filename only
} catch (IOException e) {
Util.displayIOException(e,listener);
Functions.printStackTrace(e, listener.error(Messages.ArtifactArchiver_FailedToArchive(artifacts)));
build.setResult(Result.FAILURE);
}
}

@@ -31,7 +31,6 @@ Ant.ProjectConfigNeeded= Maybe you need to configure the job to choose one of yo
ArtifactArchiver.ARCHIVING_ARTIFACTS=Archiving artifacts
ArtifactArchiver.DisplayName=Archive the artifacts
ArtifactArchiver.SkipBecauseOnlyIfSuccessful=Skipped archiving because build is not successful
ArtifactArchiver.FailedToArchive=Failed to archive artifacts: {0}
ArtifactArchiver.NoIncludes=\
No artifacts are configured for archiving.\n\
You probably forgot to set the file pattern, so please go back to the configuration and specify it.\n\
@@ -41,8 +41,6 @@ ArtifactArchiver.DisplayName=\
\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u043d\u0435 \u043d\u0430 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u0438\u0442\u0435
ArtifactArchiver.SkipBecauseOnlyIfSuccessful=\
\u041f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u043d\u0435 \u043d\u0430 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u043d\u0435\u0442\u043e, \u0437\u0430\u0449\u043e\u0442\u043e \u0438\u0437\u0433\u0440\u0430\u0436\u0434\u0430\u043d\u0435\u0442\u043e \u0435 \u043d\u0435\u0443\u0441\u043f\u0435\u0448\u043d\u043e.
ArtifactArchiver.FailedToArchive=\
\u041d\u0435\u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u043d\u0435 \u043d\u0430 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u0438: {0}
ArtifactArchiver.NoIncludes=\
\u041d\u0435 \u0441\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u0438 \u0437\u0430 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u043d\u0435.\n\
\u041f\u0440\u043e\u0431\u0432\u0430\u0439\u0442\u0435 \u0434\u0430 \u0443\u043a\u0430\u0436\u0435\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430 \u0438\u043c\u0435 \u043d\u0430 \u0444\u0430\u0439\u043b \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\u0442\u0435.\n\
@@ -57,7 +57,6 @@ JavadocArchiver.NoMatchFound=Ingen Javadoc fundet i {0}: {1}
Maven.NoExecutable=Kunne ikke finde en eksekverbar i {0}
BuildTrigger.NoSuchProject=Intet s\u00e5kaldt projekt ''{0}''. Mente du ''{1}''?
Fingerprinter.Action.DisplayName=Se Filfingeraftryk
ArtifactArchiver.FailedToArchive=Fejlede under arkivering af artifakter: {0}
Maven.NotADirectory={0} er ikke et direktorie
BuildTrigger.Disabled={0} er sl\u00e5et fra, starter ikke
Fingerprinter.Recording=Opsamler filfingeraftryk
@@ -30,7 +30,6 @@ Ant.ProjectConfigNeeded=Eventuell m\u00FCssen Sie f\u00FCr das Projekt noch eine

ArtifactArchiver.ARCHIVING_ARTIFACTS=Archiviere Artefakte
ArtifactArchiver.DisplayName=Artefakte archivieren
ArtifactArchiver.FailedToArchive=Artefakte konnten nicht archiviert werden: {0}
ArtifactArchiver.NoIncludes=Es sind keine Artefakte zur Archivierung konfiguriert.\n\u00DCberpr\u00FCfen Sie, ob in den Einstellungen ein Dateisuchmuster angegeben ist.\nWenn Sie alle Dateien archivieren m\u00F6chten, geben Sie <tt>**</tt> an.
ArtifactArchiver.NoMatchFound=Keine Artefakte gefunden, die mit dem Dateisuchmuster \u201E{0}\u201C \u00FCbereinstimmen. Ein Konfigurationsfehler?
ArtifactArchiver.SkipBecauseOnlyIfSuccessful=Archivierung wird \u00FCbersprungen, da der Build nicht erfolgreich ist.
@@ -30,7 +30,6 @@ Ant.ProjectConfigNeeded= Es posible que tengas que configurar la tarea para que

ArtifactArchiver.ARCHIVING_ARTIFACTS=Guardando archivos
ArtifactArchiver.DisplayName=Guardar los archivos generados
ArtifactArchiver.FailedToArchive=Error al guardar los archivos generados: {0}
ArtifactArchiver.NoIncludes=No hay archivos configurados para guardar.\nEs probable que olvidaras configurar el patr\u00f3n.\nSi lo que quieres es guardar todos los ficheros del espacio de trabajo, utiliza "**"
ArtifactArchiver.NoMatchFound=No se encontraron archivos que cumplan el patr\u00f3n "{0}". Comprueba la configuraci\u00f3n

@@ -29,7 +29,6 @@ Ant.NotAntDirectory={0} ne semble pas \u00eatre un r\u00e9pertoire Ant
Ant.ProjectConfigNeeded=Avez-vous configur\u00e9 le job de fa\u00e7on \u00e0 choisir une de vos installations de Ant?

ArtifactArchiver.DisplayName=Archiver des artefacts
ArtifactArchiver.FailedToArchive=Echec lors de l''archivage des artefacts: {0}
ArtifactArchiver.NoIncludes=\
Aucun artefact n''est configur\u00e9 pour l''archivage.\n\
Vous avez probablement oubli\u00e9 de positionner le pattern pour les noms des fichiers; merci de retourner \u00e0 la configuration et de le sp\u00e9cifier.\n\
@@ -35,7 +35,6 @@ Ant.ExecFailed=esecuzione del comando non riuscita.
BuildTrigger.Triggering=Attivazione di una nuova compilazione di {0}
InstallFromApache=Installa da Apache
Ant.DisplayName=Invoca Ant
ArtifactArchiver.FailedToArchive=Archiviazione degli artefatti non riuscita: {0}
CommandInterpreter.UnableToDelete=Impossibile eliminare il file script {0}
BatchFile.DisplayName=Esegui comando batch Windows
Fingerprinter.Recording=Registrazione impronte in corso
@@ -30,7 +30,6 @@ Ant.ProjectConfigNeeded=\u3069\u306eAnt\u3092\u4f7f\u3046\u304b\u30d7\u30ed\u30b

ArtifactArchiver.ARCHIVING_ARTIFACTS=\u6210\u679c\u7269\u3092\u4fdd\u5b58\u4e2d
ArtifactArchiver.DisplayName=\u6210\u679c\u7269\u3092\u4fdd\u5b58
ArtifactArchiver.FailedToArchive=\u6210\u679c\u7269\u306e\u4fdd\u5b58\u306e\u5931\u6557\u3057\u307e\u3057\u305f
ArtifactArchiver.NoIncludes=\u4fdd\u5b58\u3059\u308b\u6210\u679c\u7269\u304c\u4f55\u3082\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\n\u6050\u3089\u304f\u30d5\u30a1\u30a4\u30eb\u30d1\u30bf\u30fc\u30f3\u306e\u6307\u5b9a\u3092\u5fd8\u308c\u305f\u306e\u3067\u3057\u3087\u3046\u3002\u8a2d\u5b9a\u30da\u30fc\u30b8\u306b\u623b\u3063\u3066\u30d1\u30bf\u30fc\u30f3\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\n\u3082\u3057\u672c\u5f53\u306b\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306e\u5168\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3059\u308b\u3064\u3082\u308a\u306a\u3089\u3001"**"\u3068\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002
ArtifactArchiver.NoMatchFound=\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u30d1\u30bf\u30fc\u30f3\u300c{0}\u300d\u306b\u5408\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u8a2d\u5b9a\u30df\u30b9\uff1f

@@ -28,7 +28,6 @@ Ant.NotAntDirectory={0} is geen Ant folder
Ant.ProjectConfigNeeded= Misschien dient u uw job te configureren om \u00e9\u00e9n van je Ant installaties te gebruiken?

ArtifactArchiver.DisplayName=Archiveer de artefacten
ArtifactArchiver.FailedToArchive=Fout bij het archiveren van de artefacten: {0}
ArtifactArchiver.NoIncludes=Er werden geen artefacten voor archivering geconfigureerd.\nWaarschijnlijk werd geen bestands-selectiepatroon geconfigureerd. Gelieve dit te configureren.\n
Indien je alle bestanden in de werkplaats wenst te archiveren, gelieve dan "**" als patroon te configureren.
ArtifactArchiver.NoMatchFound=Er werden geen artefacten gevonden die voldoen aan het bestands-selectiepatroon "{0}". Misschien dient U uw configuratie aan te passen?
@@ -28,7 +28,6 @@ Ant.NotAntDirectory={0} n\u00e3o parece ser um diret\u00f3rio Ant
Ant.ProjectConfigNeeded= \u00c9 necess\u00e1rio configurar a job para escolher uma de suas instala\u00e7\u00f5es do Ant.

ArtifactArchiver.DisplayName=Arquivar os artefatos
ArtifactArchiver.FailedToArchive=Falha ao arquivar os artefatos: {0}
ArtifactArchiver.NoIncludes=Nenhum artefato est\u00e1 configurado para arquivamento.\n \u00c9 necess\u00e1rio informar o padr\u00e3o de arquivo, volte para a configura\u00e7\u00e3o e especifique-o.\nSe necessitar arquivar todos os arquivos do workspace, por favor especifique "**"
ArtifactArchiver.NoMatchFound=Nenhum artefato encontrado casa com o padr\u00e3o de arquivo "{0}". Erro de configura\u00e7\u00e3o?

@@ -28,7 +28,6 @@ Ant.NotAntDirectory={0} \u043d\u0435 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d
Ant.ProjectConfigNeeded= \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0430\u0448\u0430 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u044f Ant?

ArtifactArchiver.DisplayName=\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b
ArtifactArchiver.FailedToArchive=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b\: {0}
ArtifactArchiver.NoIncludes=\
\u041d\u0435\u0442 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438.\n\
\u041f\u043e\u0445\u043e\u0436\u0435, \u0432\u044b \u0437\u0430\u0431\u044b\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0432\u0435\u0440\u043d\u0438\u0442\u0435\u0441\u044c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0435\u0433\u043e.\n\
@@ -10,7 +10,6 @@ Ant.ProjectConfigNeeded=\u041F\u043E\u043A\u0443\u0448\u0430\u0458\u0442\u0435 \
ArtifactArchiver.ARCHIVING_ARTIFACTS=\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u045A\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043A\u0442\u0438
ArtifactArchiver.DisplayName=\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u0458 \u0430\u0440\u0442\u0435\u0444\u0430\u043A\u0442\u0438
ArtifactArchiver.SkipBecauseOnlyIfSuccessful=\u041F\u0440\u0435\u0441\u043A\u043E\u045B\u0430\u0432\u0430 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u045A\u0435 \u0437\u0430\u0448\u0442\u043E \u0458\u0435 \u0438\u0437\u0433\u0440\u0430\u0434\u045A\u0430 \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u0430
ArtifactArchiver.FailedToArchive=\u041D\u0435\u0443\u0441\u043F\u0440\u0435\u0448\u043D\u043E \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u045A\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043A\u0442\u0438: {0}
ArtifactArchiver.NoIncludes=\u041D\u0435\u043C\u0430 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0445 \u043F\u0440\u0435\u0434\u043C\u0435\u0442\u0430 \u0437\u0430 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u045A\u0435.\n\
\u0418\u0437\u0433\u043B\u0435\u0434\u0430 \u0434\u0430 \u043D\u0438\u0441\u0442\u0435 \u043D\u0430\u0432\u0435\u043B\u0438 \u0448\u0430\u0431\u043B\u043E\u043D \u0438\u043C\u0435\u043D\u0430 \u0434\u0430\u0442\u043E\u0442\u0435\u043A\u0435. \u041C\u043E\u043B\u0438\u043C\u043E \u0432\u0430\u0441, \u0432\u0440\u0430\u0442\u0438\u0442\u0435 \u0441\u0435 \u043D\u0430 \u0442\u0430\u0458 \u0435\u043A\u0440\u0430\u043D \u0438 \u0443\u043D\u0435\u0441\u0438\u0442\u0435 \u0433\u0430.\n\
\u0410\u043A\u043E \u0437\u0430\u0438\u0441\u0442\u0430 \u0436\u0435\u043B\u0438\u0442\u0435 \u0434\u0430 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0430 \u0441\u0432\u0435 \u0434\u0430\u0442\u043E\u0442\u0435\u043A\u0435 \u0443 \u0440\u0430\u0434\u043D\u043E\u043C \u043F\u0440\u043E\u0441\u0442\u043E\u0440\u0443, \u0443\u043D\u0435\u0441\u0438\u0442\u0435 "**"
@@ -28,7 +28,6 @@ Ant.NotAntDirectory={0}, bir Ant dizinine benzemiyor
Ant.ProjectConfigNeeded= \u00c7al\u0131\u015ft\u0131rd\u0131\u011f\u0131n\u0131z i\u015f i\u00e7in bir Ant kurulumu se\u00e7meniz gerekiyor olabilir?

ArtifactArchiver.DisplayName=Artefaktlar\u0131 Ar\u015fivle
ArtifactArchiver.FailedToArchive=Artefakt ar\u015fivleme ba\u015far\u0131s\u0131z oldu\: {0}
ArtifactArchiver.NoIncludes=\
Herhangi bir artefakt, ar\u015fivleme i\u00e7in ayarlanmad\u0131.\n\
Konfig\u00fcrasyon k\u0131sm\u0131nda File Pattern ayarlar\u0131n\u0131 kontrol edin.\n\
@@ -30,7 +30,6 @@ Ant.ProjectConfigNeeded=\u4e5f\u8a31\u60a8\u61c9\u8a72\u8a2d\u5b9a\u5c08\u6848\u

ArtifactArchiver.ARCHIVING_ARTIFACTS=\u5c01\u5b58\u6210\u54c1
ArtifactArchiver.DisplayName=\u5c01\u5b58\u6210\u54c1
ArtifactArchiver.FailedToArchive=\u7121\u6cd5\u5c01\u5b58\u6210\u54c1: {0}
ArtifactArchiver.NoIncludes=\
\u6c92\u8981\u6210\u54c1\u88ab\u8a2d\u70ba\u9700\u8981\u5c01\u5b58\u3002\n\
\u53ef\u80fd\u662f\u60a8\u5fd8\u4e86\u8a2d\u5b9a\u6a94\u6848\u6a23\u5f0f\uff0c\u8acb\u56de\u5230\u8a2d\u5b9a\u9801\u6aa2\u67e5\u770b\u770b\u3002\n\

0 comments on commit e5fd7b7

Please sign in to comment.
You can’t perform that action at this time.