Skip to content

Commit

Permalink
[FIXED JENKINS-14584] add more output at evaluation of conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
imod committed Oct 5, 2013
1 parent 9e35ee7 commit 1125b04
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
Expand Up @@ -54,7 +54,10 @@ public String getToken() {
@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception {
final String expandedToken = Util.fixEmptyAndTrim(TokenMacro.expandAll(build, listener, token));
if (expandedToken == null) return false;
listener.getLogger().println(Messages.booleanCondition_check(expandedToken, RUN_REGEX.pattern(), token));
if (expandedToken == null) {
return false;
}
return RUN_REGEX.matcher(expandedToken.toLowerCase()).matches();
}

Expand Down
Expand Up @@ -133,6 +133,8 @@ public boolean isExclusiveCause() {

@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) {
final String name = buildCause == null ? "N/A" : buildCause.displayName;
listener.getLogger().println(Messages.causeCondition_check(name));
final List<Cause> causes = build.getCauses();
if (buildCause != null) {
if (isExclusiveCause()) {
Expand Down
Expand Up @@ -61,6 +61,7 @@ public String getFile() {
@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception {
final String expandedFile = TokenMacro.expandAll(build, listener, file);
listener.getLogger().println(Messages.fileExistsCondition_check(expandedFile));
return baseDir.getBaseDirectory(build).child(expandedFile).exists();
}

Expand Down
Expand Up @@ -71,6 +71,7 @@ public Result getWorstResult() {
@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) {
final Result currentStatus = build.getResult() == null ? Result.SUCCESS : build.getResult();
listener.getLogger().println(Messages.statusCondition_check(currentStatus, worstResult, bestResult));
return worstResult.isWorseOrEqualTo(currentStatus) && bestResult.isBetterOrEqualTo(currentStatus);
}

Expand Down
Expand Up @@ -26,17 +26,21 @@ alwaysRun.displayName=Always
neverRun.displayName=Never

statusCondition.displayName=Current build status
statusCondition.check=[Current build status] check if current [{0}] is worse or equals then [{1}] and better or equals then [{2}]
expressionCondition.displayName=Regular expression match
numericalComparison.displayName=Numerical comparison
booleanCondition.displayName=Boolean condition
booleanCondition.check=[Boolean condition] checking [{0}] against [{1}] (origin token: {2})
fileExistsCondition.displayName=File exists
fileExistsCondition.check=[File exists] check if file exists [{0}]
filesMatchCondition.displayName=Files match
stringsMatchCondition.displayName=Strings match
timeCondition.displayName=Time
dayCondition.displayName=Day of week
causeCondition.displayName=Build Cause
causeCondition.check=[Build Cause] check if build was triggered by [{0}]
nodeCondition.displayName=Execution node
nodeCondition.check=check if [{0}] is in [{1}]
nodeCondition.check=[Execution node] check if [{0}] is in [{1}]

logic.and.displayName=And
logic.or.displayName=Or
Expand Down

0 comments on commit 1125b04

Please sign in to comment.