How to properly use ${FILE,path=foo.txt} in Jenkins?

17 views
Skip to first unread message

Ilia Basin

unread,
Oct 25, 2019, 2:16:03 AM10/25/19
to Jenkins Users
Hi.
I'm trying to use the syntax `${FILE,path=foo.txt}` to  introduced in Token Macro Plugin 1.11. My plugin version is 1.12.1
In what context can this be used? My project is a freestyle project. It creates foo.txt, then I have the EnvInject step with the following:

    AAA=${FILE,path=foo.txt}

and then the shell step:

    echo "AAA=$AAA"

Here's the console output:

    [basintest] $ /u01/jenkins/jenkins_shell -xe /tmp/hudson8306494744167210672.sh
    + . /tmp/hudson8306494744167210672.sh
    ++ cat foo.txt
    aaa
    [EnvInject] - Injecting environment variables from a build step.
    [EnvInject] - Injecting as environment variables the properties content
    AAA=${FILE,path=foo.txt}
   
    [EnvInject] - Variables injected successfully.
    [basintest] $ /u01/jenkins/jenkins_shell -xe /tmp/hudson6182970742482538021.sh
    + . /tmp/hudson6182970742482538021.sh
    ++ echo 'AAA=${FILE,path=foo.txt}'
    AAA=${FILE,path=foo.txt}
    Finished: SUCCESS

Slide

unread,
Oct 25, 2019, 8:19:00 AM10/25/19
to Jenkins User Mailing List
It doesn't look like the envinject plugin has any sort of dependency on the token-macro plugin, which means you can't use the FILE token there.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c745bd95-a598-40dc-8c9d-2fd63edc6070%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages