execute Build forge project from command line
Hi all,
I want to execute a build forge project from command line. I need to run the command from a perl script. I found a tool called bftool, but this tool is from version 7.0.2, i wanted to know if there is something newer. My build forge version is 7.1.1.4. Thanks, Shiran |
20 answers
hi bju,
I am trying to set a user email in the perl API. when i write the email in the code $user='builder'; $user = BuildForge::Services::DBO::User->findByLogin($conn, 'builder'); $user->setEmail('user@company.com"); $user->update(); It worked, but when i tried to set the email with a variable it doesn't work: $user->setEmail($mail); When i print to the screen the $mail i see the right mail. in the catalina i see: 7/20/2010 4:33:14 PM: Mail: 4672: CRRBF0631I: User 'builder' does not have a val id email address defined to receive mail notifications. But the email is ok and it worked with the same email before. Can you help? Thanks, |
Hi Shiran,
Could you give this script a try? If this doesn't work, if you could retrieve the server side exception like we did on one of the previous scripts that would help in figuring out what is happening. Also, if there is anything special about the user such as if it is a LDAP user. use strict; bju |
Bju,
This script works for me really good. Thanks for the script Can you please help me on below questions 1.Using API scripts is that possible to see the all step information 2.Is that possible to send the pass email to team at end of project pass message using API (any email id not the user email id) Please let me know if you have any other questions. Thanks for your kind help Thanks Johnson
Hi, This is an example of changing a build environment entry value. This will only change the environment variable value at the time of starting the build.
bju Hi bju, It worked for 1 project but now when i try from a different stream or different project i get this message: BuildForge::Ex::APIException: A valid Value must be specified. I see that i get the information, for example: Do you know what is the problem? Thanks for your help, Shiran |
Bju,
This script works for me really good. Thanks for the script Can you please help me on below questions 1.Using API scripts is that possible to see the all step information 2.Is that possible to send the pass email to team at end of project pass message using API (any email id not the user email id) Please let me know if you have any other questions. Thanks for your kind help Thanks Johnson Bju,
Hi, This is an example of changing a build environment entry value. This will only change the environment variable value at the time of starting the build.
bju Hi bju, It worked for 1 project but now when i try from a different stream or different project i get this message: BuildForge::Ex::APIException: A valid Value must be specified. I see that i get the information, for example: Do you know what is the problem? Thanks for your help, Shiran |
Bju, Hi, Yes, you can use the Perl BuildForge::Services::DBO::Step.pm or Java com.buildforge.services.client.dbo.Step.java to get the step data. For sending email, I was wondering if you have tried the .email dot command. You could have a step with the command text of something like '.email project_team@my.company.com'. bju |
Bju,
I added this line use BuildForge::Services::DBO::Step.pm; to my below perl script but I am getting this error syntax error at ./build.pl line 5, near "use BuildForge::Services::DBO::Step. I am not sure is that right or not, In that case can you tell me how to use that command. also can we add the .email option at end of the script ? or need to add that into step command ? Will be great If I can use that .email option from API script. #!/usr/bin/perl use strict; use BuildForge::Services; use BuildForge::Services::DBO::Step.pm; 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(); Once again thanks for your great help Thanks Johsnon Bju, Hi, Yes, you can use the Perl BuildForge::Services::DBO::Step.pm or Java com.buildforge.services.client.dbo.Step.java to get the step data. For sending email, I was wondering if you have tried the .email dot command. You could have a step with the command text of something like '.email project_team@my.company.com'. bju |
Bju, Hi, Before recommending a solution, it probably would be good to step back a bit so that I understand what information you would like to get about the step. Is there a particular piece of data that you're trying to retrieve? As for the email, the .email dot command would have to be in the step command text. I can show you some code for adding a step to the project or altering an existing step to add another command. However, if you're not interested in altering your project steps, you might do an Internet search on the words: Send Email Perl MIME-Lite . You should get some links for examples sending email. The MIME-Lite package is one of a number of Perl packages that can be used in Perl code to send email. bju |
Bju,
We have plan to give the perl script to developers to run the build at any time(Execute the build from command line). We don't want to give the console access. Each project has 14 steps at the end of 14 step need to send the project pass notification to developer Using that perl script is that possible to see the step messages like running,passed,failed dont want to see the step log or if you have any idea to see the step log that will be great too. (basically need to know which step currently running ) I added the .email jjoseph@outcome.com at the end of step command text but I coudnt get the eamil here is the step log Step sending generic step email to: jjoseph@outcome.com But I didnt get this email . Let me know if you need more info Thanks Johnson Bju, Hi, Before recommending a solution, it probably would be good to step back a bit so that I understand what information you would like to get about the step. Is there a particular piece of data that you're trying to retrieve? As for the email, the .email dot command would have to be in the step command text. I can show you some code for adding a step to the project or altering an existing step to add another command. However, if you're not interested in altering your project steps, you might do an Internet search on the words: Send Email Perl MIME-Lite . You should get some links for examples sending email. The MIME-Lite package is one of a number of Perl packages that can be used in Perl code to send email. bju |
Hi,
I've pasted some sample code of displaying the running status. You could do some fancier stuff with the display to the console, but I've just printed the output approximately every second. I used the script that you had pasted. The last part after firing the build contains the new code. I tried the .email on my system here and did get the email. In your test did it ever arrive?
bju |
BJU,
Your the man, I can able to see all the step messages . Thanks for the great help. .email doesn't work for me I dont know why, Here is the log from build forge serevr I used this syntax on step command text .email jjoseph@outcome.com Wed 18 Aug 2010 11:09:28 AM EDT: Mail: 5572: CRRBF1482I: Selected external user: Wed 18 Aug 2010 11:09:28 AM EDT: Mail: 5572: CRRBF0780I: Generating email to using [] template via . Wed 18 Aug 2010 11:09:28 AM EDT: Mail: 5572: CRRBF0998E: Attempt to send mail to using failed : no data in this part Once again thanks for the great help Thanks Johsnon Hi, |
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.