Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

passing variables in chained projects

I am trying to use .email to send a customized message on fail of a job. The first step of the job populates a variable for the message to be sent if the job fails, as well as a variable for who it is to be sent to. I have created a template based on the jobfail default template.

Subject is $subject, and in the body of the template I have the variable $myFailMail.

I have a calling job intentionally set to fail. It includes 3 environment which I change with .bset in step 1, and a second step that is designed to fail. Onfail chain is set for the project to call a second project, which has no environment set. The template is set to associate itself with the second job.

First project:
Step 1:
.bset env "notify=jgryder@chubb.com"
.bset env "myFailMail=What seems to be the problem"
.bset env "notify=jgryder@chubb.com"

Step 2
cd FictitiousDirectory

Second Project
Step 1

.email $notify


The $notify variable seems to work. The email gets to me, but the subject and message are populated as they would be in the default template.

I have tried prefixing with $BF_CALLER_ in the second project and resetting the variable, i.e.
.bset env "myFailMail=$BF_CALLER_myFailMail" but that doesn't work either.

I've reread the documentation several times, but can't seem to crack the nut. Any help would be greatly appreciated.

Thanks,
Jonas

0 votes



2 answers

Permanent link
I am trying to use .email to send a customized message on fail of a job. The first step of the job populates a variable for the message to be sent if the job fails, as well as a variable for who it is to be sent to. I have created a template based on the jobfail default template.

Subject is $subject, and in the body of the template I have the variable $myFailMail.

I have a calling job intentionally set to fail. It includes 3 environment which I change with .bset in step 1, and a second step that is designed to fail. Onfail chain is set for the project to call a second project, which has no environment set. The template is set to associate itself with the second job.

First project:
Step 1:
.bset env "notify=jgryder@chubb.com"
.bset env "myFailMail=What seems to be the problem"
.bset env "notify=jgryder@chubb.com"

Step 2
cd FictitiousDirectory

Second Project
Step 1

.email $notify


The $notify variable seems to work. The email gets to me, but the subject and message are populated as they would be in the default template.

I have tried prefixing with $BF_CALLER_ in the second project and resetting the variable, i.e.
.bset env "myFailMail=$BF_CALLER_myFailMail" but that doesn't work either.

I've reread the documentation several times, but can't seem to crack the nut. Any help would be greatly appreciated.

Thanks,
Jonas


Hi Jonas,

I just wanted to check that I understand your scenario. I see in your first paragraph that you created a template based on the jobfail default template. Was that actually of the 'Job Fail Message' type? The reason I ask is that for the .email to send a customized template for the project/step, it will have to be of type 'Step .email Message'.

Brent Ulbricht
Developer/Lead - RTC Build

0 votes


Permanent link
I am trying to use .email to send a customized message on fail of a job. The first step of the job populates a variable for the message to be sent if the job fails, as well as a variable for who it is to be sent to. I have created a template based on the jobfail default template.

Subject is $subject, and in the body of the template I have the variable $myFailMail.

I have a calling job intentionally set to fail. It includes 3 environment which I change with .bset in step 1, and a second step that is designed to fail. Onfail chain is set for the project to call a second project, which has no environment set. The template is set to associate itself with the second job.

First project:
Step 1:
.bset env "notify=jgryder@chubb.com"
.bset env "myFailMail=What seems to be the problem"
.bset env "notify=jgryder@chubb.com"

Step 2
cd FictitiousDirectory

Second Project
Step 1

.email $notify


The $notify variable seems to work. The email gets to me, but the subject and message are populated as they would be in the default template.

I have tried prefixing with $BF_CALLER_ in the second project and resetting the variable, i.e.
.bset env "myFailMail=$BF_CALLER_myFailMail" but that doesn't work either.

I've reread the documentation several times, but can't seem to crack the nut. Any help would be greatly appreciated.

Thanks,
Jonas


Hi Jonas,

I just wanted to check that I understand your scenario. I see in your first paragraph that you created a template based on the jobfail default template. Was that actually of the 'Job Fail Message' type? The reason I ask is that for the .email to send a customized template for the project/step, it will have to be of type 'Step .email Message'.

Brent Ulbricht
Developer/Lead - RTC Build

Hi,

I also have a problem to send an email in Fail Chain project:

1. I have a tmplate using 'Step .email Message'
2. From my main project i have chain project called OnFail
3. In the fail project i run 2 commands:
a. .email Guest - this works and send the email to this group
b. .email ${MAIL} - this suppose to send a message to the email i have in MAIL variable, that i have set before i started the project. but i see in the log that this variable value is "/var/mail/builder" instead of the email string.

Please help,
shiran

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Apr 12 '11, 9:30 a.m.

Question was seen: 4,216 times

Last updated: Apr 12 '11, 9:30 a.m.

Confirmation Cancel Confirm