It's all about the answers!

Ask a question

Dot commands


sridevi yv (10632) | asked Aug 12 '10, 4:33 a.m.
hi,
i have to launch a project on the failure of a step of another project and after that the failed step has to be re-executed.. so i can set the project to be lauched in fail chain field and use .retry command in the last step of the called project.
but .retry command takes only script names as arguments..can i use project names or step names which have previously failed as arguments? wat can do abt this??

22 answers



permanent link
Johnson Joseph (811) | answered Aug 24 '10, 1:55 p.m.
bju,
I couldn't see the type select as Step .email Message I can able to see below type templates

Filter Match message
Project Run .break message
Project Run fail message
Project run pass message
Project run start message
project run warn message
purge fail message
step fail message
step pass message
step warn messge

Thanks

Bju,
I am not sure how to add the body of the email using .email command.
Can you please explain me how ro do that like CC,subject and body of the email using .email command

Thanks for all your help

Thanks
Johnson


Hi,

This may not be the problem I originally thought it was, but if you would like to create a custom email template you can try these steps.

1) Navigate to Projects -> Templates
2) Push 'Add Template' Button
3) For Type select 'Step .email Message' and select your project and step in the drop downs
4) Press the 'Save' button
5) In the upper frame after saving, select the newly created 'Step .email Message' template that corresponds to your project and step
6) Fill in your Description, Subject, From, and Body for the email
7) Press 'Save' button

bju

permanent link
Brent Ulbricht (2.5k11) | answered Aug 24 '10, 3:14 p.m.
JAZZ DEVELOPER
bju,
I couldn't see the type select as Step .email Message I can able to see below type templates

Filter Match message
Project Run .break message
Project Run fail message
Project run pass message
Project run start message
project run warn message
purge fail message
step fail message
step pass message
step warn messge

Thanks


Hi,

What release of Build Forge are you using? If you go to on Windows or /Platform on Unix and execute a 'buildforge -v' that will give you the release and build number.

bju

permanent link
Johnson Joseph (811) | answered Aug 24 '10, 3:16 p.m.
Hi Bju,
I am using this build forge version
buildforge 7.1.1.1-0-0046

bju,
I couldn't see the type select as Step .email Message I can able to see below type templates

Filter Match message
Project Run .break message
Project Run fail message
Project run pass message
Project run start message
project run warn message
purge fail message
step fail message
step pass message
step warn messge

Thanks


Hi,

What release of Build Forge are you using? If you go to on Windows or /Platform on Unix and execute a 'buildforge -v' that will give you the release and build number.

bju

permanent link
Brent Ulbricht (2.5k11) | answered Aug 25 '10, 9:12 a.m.
JAZZ DEVELOPER
Hi Bju,
I am using this build forge version
buildforge 7.1.1.1-0-0046


Hi,

Are you running on migrated data?

bju

permanent link
Johnson Joseph (811) | answered Aug 25 '10, 9:22 a.m.
Bju,
Yes We did the data base migration and historical data migration from 7.0.2 to 7.1.1.1 is that any problem ?


Thanks
Johson

Hi Bju,
I am using this build forge version
buildforge 7.1.1.1-0-0046


Hi,

Are you running on migrated data?

bju

permanent link
Brent Ulbricht (2.5k11) | answered Aug 25 '10, 10:38 a.m.
JAZZ DEVELOPER
Bju,
Yes We did the data base migration and historical data migration from 7.0.2 to 7.1.1.1 is that any problem ?


Thanks
Johson


I think it's a bug in the migration code. If you're willing to try a services layer client to recreate the step email template for en_US locale, you could try the code below. I tried to put the most likely values that you'll need to modify at the top (host, user, password, project name).


use strict;

use BuildForge::Services;

my $host = 'localhost';
my $user = 'root';
my $password = 'root';
my $projectName = 'P_1';

my $conn = new BuildForge::Services::Connection($host);
my $token = $conn->authUser($user, $password);

my $project = BuildForge::Services::DBO::Project->findByName($conn, $projectName);
die('Could not find project ' . $projectName) unless defined($project);

my $template = new BuildForge::Services::DBO::Template($conn);
$template->setType('step_email');
$template->setProjectUuid($project->getUuid());
$template = $template->create();

print "Created step_email template for " . $projectName . " (" . $project->getUuid() . ")" . "\n";

my $templateBody = new BuildForge::Services::DBO::TemplateBody($conn);
$templateBody->setTemplateUuid($template->getUuid());
$templateBody->setDescription('Step .email Message');
$templateBody->setFrom('buildforge@outcome.com');
$templateBody->setSubject('${PROJECTNAME}:${TAG} of the project ${PROJECTNAME} at step ${STEPNAME} sent you this email.');
$templateBody->setBodyText('Job ${TAG} of the project ${PROJECTNAME} at step ${STEPNAME} sent you this email.');
$templateBody->setLocale('en_US');
$templateBody = $templateBody->create();

print "Created template body (" . $templateBody->getUuid() . ") for step_email template with uuid of " . $template->getUuid() . "\n";

$conn->logout();
$conn->close();


bju

permanent link
Johnson Joseph (811) | answered Aug 25 '10, 11:06 a.m.
Bju,
Below script works for me that was good. But we have 162 projects so I need to add .email template on 162 projects on each time ? Can you provide me if you have any script which is common for all the projects ?
Thanks for all your great help


Thanks
Johnson

Bju,
Yes We did the data base migration and historical data migration from 7.0.2 to 7.1.1.1 is that any problem ?


Thanks
Johson


I think it's a bug in the migration code. If you're willing to try a services layer client to recreate the step email template for en_US locale, you could try the code below. I tried to put the most likely values that you'll need to modify at the top (host, user, password, project name).


use strict;

use BuildForge::Services;

my $host = 'localhost';
my $user = 'root';
my $password = 'root';
my $projectName = 'P_1';

my $conn = new BuildForge::Services::Connection($host);
my $token = $conn->authUser($user, $password);

my $project = BuildForge::Services::DBO::Project->findByName($conn, $projectName);
die('Could not find project ' . $projectName) unless defined($project);

my $template = new BuildForge::Services::DBO::Template($conn);
$template->setType('step_email');
$template->setProjectUuid($project->getUuid());
$template = $template->create();

print "Created step_email template for " . $projectName . " (" . $project->getUuid() . ")" . "\n";

my $templateBody = new BuildForge::Services::DBO::TemplateBody($conn);
$templateBody->setTemplateUuid($template->getUuid());
$templateBody->setDescription('Step .email Message');
$templateBody->setFrom('buildforge@outcome.com');
$templateBody->setSubject('${PROJECTNAME}:${TAG} of the project ${PROJECTNAME} at step ${STEPNAME} sent you this email.');
$templateBody->setBodyText('Job ${TAG} of the project ${PROJECTNAME} at step ${STEPNAME} sent you this email.');
$templateBody->setLocale('en_US');
$templateBody = $templateBody->create();

print "Created template body (" . $templateBody->getUuid() . ") for step_email template with uuid of " . $template->getUuid() . "\n";

$conn->logout();
$conn->close();


bju

permanent link
Brent Ulbricht (2.5k11) | answered Aug 25 '10, 1:47 p.m.
JAZZ DEVELOPER
Bju,
Below script works for me that was good. But we have 162 projects so I need to add .email template on 162 projects on each time ? Can you provide me if you have any script which is common for all the projects ?
Thanks for all your great help


Thanks
Johnson


Hi,

I opened a defect to have the development team see if there is another solution. The problem that I ran into with the script is that the services layer requires a project uuid when creating a template. In this case, what we really want to do is recreate a base template type instead of create a custom template that is to be used per project/step. The only other option I can think of is to do some inserts into your database, but I'm hoping through the defect that there might be another option. Feel free to add comments to the defect if I didn't capture something.

http://jazz.net/jazz08/web/projects/Rational%20Build%20Forge#action=com.ibm.team.workitem.viewWorkItem&id=17759

bju

permanent link
Johnson Joseph (811) | answered Aug 25 '10, 1:59 p.m.
Bju,
Thanks for the help. Lets hope will get the answer as soon as possible from dev team. Is there any other way to send an email to team for the pass notify?

Once again thanks for the help

Thanks
Johnson

Bju,
Below script works for me that was good. But we have 162 projects so I need to add .email template on 162 projects on each time ? Can you provide me if you have any script which is common for all the projects ?
Thanks for all your great help


Thanks
Johnson


Hi,

I opened a defect to have the development team see if there is another solution. The problem that I ran into with the script is that the services layer requires a project uuid when creating a template. In this case, what we really want to do is recreate a base template type instead of create a custom template that is to be used per project/step. The only other option I can think of is to do some inserts into your database, but I'm hoping through the defect that there might be another option. Feel free to add comments to the defect if I didn't capture something.

http://jazz.net/jazz08/web/projects/Rational%20Build%20Forge#action=com.ibm.team.workitem.viewWorkItem&id=17759

bju

permanent link
Brent Ulbricht (2.5k11) | answered Aug 26 '10, 10:31 a.m.
JAZZ DEVELOPER
Bju,
Thanks for the help. Lets hope will get the answer as soon as possible from dev team. Is there any other way to send an email to team for the pass notify?

Once again thanks for the help

Thanks
Johnson


Hi Johnson,

You might want to just use the MIME::Lite package directly to send an email instead of using a Build Forge feature. I have attached the script that we've been working with that contains a few lines at the bottom to send an email using MIME::Lite. You'll have to modify the variables to your liking (ex. to, from, message, etc.).


You'll also need to make sure that your system has the MIME::Lite package. You can use cpan to retrieve it if you don't have it.



#!/usr/bin/perl
use strict;

use BuildForge::Services;

use MIME::Lite;

my $conn = new BuildForge::Services::Connection('localhost');
my $token = $conn->authUser('root', 'root');

my $projectName = 'EMBEDAPAT_TEST';
my $project = BuildForge::Services::DBO::Project->findByName($conn, $projectName);
die("Could not find project named: " . $projectName) unless defined($project);

my $newBuild = BuildForge::Services::DBO::Build->create($conn, $project->getUuid());
die("Could not create build for project: " . $project->getName()) unless defined($newBuild);

my $buildEnvUuid = $newBuild->getBuildEnvUuid();
die("Did not get build env uuid") unless defined($buildEnvUuid);

my $buildEnv = BuildForge::Services::DBO::BuildEnvironment->findByUuid($conn, $buildEnvUuid);
die("Could not find build environment uuid: " . $buildEnvUuid) unless defined($buildEnv);

my $myEnvVar = 'BUILDFILE';
my $buildEnvEntry = $buildEnv->getEntry($myEnvVar);
die("Could not get build env entry named: " . $myEnvVar) unless defined($buildEnvEntry);

my $oldBuildEnvEntryVal = $buildEnvEntry->getValue();
my $newBuildEnvEntryVal = 'Install/KING/EMBEDA_PAT/100811/100818_build_nosql.xml';
$newBuild->updateBuildEnvEntryValue($buildEnvEntry->getUuid(), $newBuildEnvEntryVal);
print "Changed build env entry val from " . $oldBuildEnvEntryVal . " to " . $newBuildEnvEntryVal . "\n";

$newBuild = $newBuild->fireBuild();

my $timeOut = 300;

my $buildState = $newBuild->getState();

for (my $i = 0; ($i < $timeOut) && ($buildState ne 'COMPLETED'); $i++) {
sleep 1;
$newBuild = BuildForge::Services::DBO::Build->findByUuid($conn, $newBuild->getUuid());
die("Could not get the build") unless defined($newBuild);
$buildState = $newBuild->getState();
my $results = $newBuild->getResults();
die("Could not get the results for the build") unless defined($results);
print $i . ": Project Name: " . $projectName . "\tTag: " . $newBuild->getTag() . "\tState: " . $newBuild->getState() . "\n";
foreach my $result (@$results) {
print "\tStep Description: " . $result->getDescription() . "\tStep Result: " . $result->getResult() . "\n";
}
print "\n";
}

die("Build did not complete in under " . $timeOut . " seconds.") if ($buildState ne 'COMPLETED');

print "Final Build Result: " . $newBuild->getResult() . "\n";

my $to = "build.recipient\@my.company.com";
my $from = "buildforge\@my.company.com";
my $subject = "Build Status: " . $newBuild->getResult();
my $message = "The result of the build was " . $newBuild->getResult() . ".";

my $msg = MIME::Lite->new(From => $from, To => $to, Subject => $subject, Data => $message);
MIME::Lite->send('smtp', 'localhost', Timeout => 60);
$msg->send();


bju

Your answer


Register or 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.