[ 
https://issues.jenkins-ci.org/browse/JENKINS-13509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=163192#comment-163192
 ] 

Chris Holman commented on JENKINS-13509:
----------------------------------------

I fixed this locally using an additional catch statement in 
org.jenkinsci.plugins.buildnamesetter.BuildNameSetter.setDisplayName(...):

{code}
    private void setDisplayName(AbstractBuild build, BuildListener listener) 
throws IOException, InterruptedException {
        try {
            build.setDisplayName(TokenMacro.expand(build, listener, template));
        } catch (MacroEvaluationException e) {
            listener.getLogger().println(e.getMessage());
        } catch (FileNotFoundException fnfe) {
            listener.getLogger().println(fnfe.getMessage());
        }
    }
{code}
                
> PROPFILE handling of missing file isn't very nice
> -------------------------------------------------
>
>                 Key: JENKINS-13509
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-13509
>             Project: Jenkins
>          Issue Type: Bug
>          Components: build-name-setter, token-macro
>         Environment: Jenkins 1.460
> build-name-setter 1.3
> token macro plugin 1.5.1
>            Reporter: Paul Milliken
>            Assignee: Kohsuke Kawaguchi
>            Priority: Minor
>
> My build generates a properties file containing version information (derived 
> from various things like the subverison revision and branch name). I'd like 
> to be able to include this in my build names automatically. I'm looking at 
> setting the build name to something like this:
> #${BUILD_NUMBER} - ${PROPFILE,file="version.properties",property="version"}
> Since build-name-setting runs twice (once after checkout and once after 
> build), the first attempt fails as the properties file doesn't exist yet.
> In the case when I try to use an invalid macro, an message is logged in the 
> console output ("Unrecognized macro 'XXX' in ....") but the build otherwise 
> continues. However, in this case, a FATAL error is logged:
> FATAL: /home/jenkins/.jenkins/jobs/..../version.properties (No such file or 
> directory)
> java.io.FileNotFoundException: 
> /home/jenkins/.jenkins/jobs/..../version.properties (No such file or 
> directory)
> <rest of stack trace>
> It would be nice if the behaviour was consistent, and the absence of the 
> properties file simply resulted in a warning similar to an invalid macro, 
> rather than completely breaking the build.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to