Yes, this is expected, the file token supports nested content.

Sent from my Windows Phone
From: chris_willia...@dell.com
Sent: 1/11/2013 3:02 PM
To: jenkinsci-users@googlegroups.com
Subject: Email-ext plugin. variable substitution in included file ?
We are using the "${FILE,path}" token to include the contents of a
file in the workspace to an email being sent by the Email-ext plugin.
We also have a parameter on this particular job (i.e. parameterized build).

It appears that if the file being included uses a variable with the
same name as the job parameter, then the value of the parameter is
substituted for that variable in the sent email. Is this expected
behavior or should this be considered a bug ? We can work around the
problem by changing the parameter name, but that's a hack. I've also
experimented with trying to reset the parameter before the email is
sent, but it doesn't work or I'm doing it wrong.

Example:
1) Job has a parameter named "PASSWD".
2) Ext-email uses the token: ${FILE, path="./foo.sh"}
3) foo.sh contents:
echo ${PASSWD}

4) When the email is sent, the ${PASSWD} variable in foo.sh is
evaluated and the email contains the value that was typed in for the
PASSWD job parameter.

I'll open an issue if this is considered a bug or unexpected. An
additional data point is, that if I'm including a file named "foo.txt"
instead of "foo.sh", then the "${PASSWD}" string is not evaluated and
appears as expected in the email.

Thanks,
Chris

Chris Williams
Dell | PG Release Engineering

Reply via email to