It's all about the answers!

Ask a question

Sending variable to Build Forge


Leandro Leal (14624345) | asked Sep 21 '11, 9:25 a.m.
Good Morning,

We are using Build Forge to move applications between servers in development, quality, production ... but the names of the folders that are moved are dynamic and need to send the name folder to BF. How I can do this?

should create an interface that does the work? how communication performed via commands?

2 answers



permanent link
Brent Ulbricht (2.5k11) | answered Sep 21 '11, 1:08 p.m.
JAZZ DEVELOPER
Good Morning,

We are using Build Forge to move applications between servers in development, quality, production ... but the names of the folders that are moved are dynamic and need to send the name folder to BF. How I can do this?

should create an interface that does the work? how communication performed via commands?


Hi,

I would recommend looking at the .bset dot command with the syntax allowing you to set the variable value to the output of a command on the agent. An example of this syntax would look like:

.bset env "MY_VAR=`/opt/my_script.sh`"

Brent Ulbricht
RTC Build Lead

permanent link
Jonas Gryder (11663) | answered Oct 12 '11, 3:13 p.m.
We do something similar to this in our shop. We have a file structure that while variable from one environment to another, is changed in a predictable way. Thus, you can use .bset to set variables to build the path using info from the originating environment:

Example: assume that most of the paths are different, but that a single directory is in common. Your environment can contain variables for known parts of the path, and you can retrieve the rest from the originating system:

Original path:
.bset env "AppName=`ls /InBox/$CM_Number/WFS_FOCEXEC`"

$CM_Number is a variable passed through the environment. This step will retrieve the name of a single directory under WFS_FOCEXEC and assign it to $AppName. You can come up with ways to handle multiple folders and different structures, but this example fits our standards.

We then move the files from this standardized developer environment to a test environment using the information retrieved, plus knowledge of where we keep our test files.

In our case, we use Rync from the original server to place the contents on the test server:

/usr/bin/rsync -avzK /InBox/${CM_Number}/WFS_FOCEXEC/${AppName}/ bfuser@server1:/server2/opt/app/ibi/appsdirectory/${AppName}/

While this is a relatively simple example on two Linux boxes, but given some standardization in naming conventions, you should be able to extrapolate more complex conditions or other operating systems from here.

I did not show it in detail for the sake of simplicity, but we set environment variables to test for several possible file structure before making the move. Nesting the various possibilities within ifs allows us to choose the path to send to.

if $testvar==structure1
move a to b
end job with success

if $testvar==structure2
move c to d
end job with success
else fail job

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.