Hello everyone,
In our build system we have a requirement that we need to modify the value of a variable living in a configuration from a build that lives in a sibling configuration.
To give you more context I have this setup;
Root
-> Branch_A
-> Deploy
-> Promote_A_to_B
-> Branch_B
-> Deploy
Each branch has a variable named "commit" with different values. So every time I run Branch_A's Deploy, Branch_A's "commit" is updated to the current commit number, while Branch_B's "commit" remains intact.
What I want to do is updating Branch_B's "commit" number when Promote_A_to_B runs.
What I've tried so far;
- I created a temporary build, set it's configuration as the target one, get the commit variable wrapper and set it's value as the wanted one.
def Main()
{
def promote_commit = vars.getValue("commit");
def target_config_path = "Root/Branch_B";
def configuration_obj = system.configurationManager.get( target_config_path );
def tempBuild = new Build();
tempBuild .setConfiguration( configuration_obj );
def current_target_cl = tempBuild .getVar("Promote_Changelist");
current_target_cl.setValue( promote_commit, true );
}
Result -> Branch_A's "commit" number modified, not the targeted one.
- I tried to set the commit value I want to the target variable by getting it from the target configuration object.
def Main()
{
def promote_commit = vars.getValue("commit");
def target_config_path = "Root/Branch_B";
def configuration_obj = system.configurationManager.get( target_config_path );
def fetched_commit = configuration_obj.findVar("commit");
fetched_commit.setValue( promote_commit );
}
Result -> The PromoteA_to_B build has the correct "commit" values for both Branch_A and Branch_B, but Branch_B's "commit" remains the same
Does anyone have done something similar or can help?
- solved #2
- replies 2
- views 449
- stars 1