Post

2 followers Follow
0
Avatar

Updating Variables after launching from Groovy Script

We launch a release from a Groovy script that is source controlled, which inserts a variable, ${var1}, into an XLDeploy control task field. Upon execution and creation of the release, ${var1} = '0', but gets updated as part of a Jython script task after the release is created. Even though the Jython script task updates the variable during the release, the input in the control task stays at 0 because that is what it was at the time of execution. Let me know if I can provide any other information that would help find a solution.

Matthew Reed

Please sign in to leave a comment.

4 comments

0
Avatar

Hi Matthew

Variables are resolved into values when a task starts.

There are a lot of moving parts in your case and it is a bit hard to see what is going on. Can you share a (simplified) script or template that illuminates the problem?

Thanks,

Hes Siemelink 0 votes
0
Avatar

Hi Hes. Sure, I can simplify a little. So we have a task (launcher) that executes a Groovy script to create a new release. In that new release, we have a set of XLDeploy control tasks, and each control task contains a releaseVariable. Upon executing the Groovy script and creating the release, that releaseVariable is 0. However, that releaseVariable gets updated by a Jython script before the control task, but stays 0 in the control task. Is there a way to get it to automatically update?

Matthew Reed 0 votes
0
Avatar

HI Matthew

From what I understand now, we have two releases

Release A:

  • Contains the Groovy script that starts Release B

Release B:

  • Contains the XL Deploy tasks with releaseVariable ${var1}

Now the question is where the ${var1} is defined. If the Jython script runs in Release A it will not update ${var1} in Release B. 

It will help if you share the (simplified) templates, so it is easier to see what is going on.

Kind regards,

Hes Siemelink 0 votes
0
Avatar

Hes, 

Fortunately, we were able to find a workaround. We had a "dummy" control task created when the Groovy was executed, and a Jython script to check if we needed additional control tasks. If we did, the control task cloned the "dummy" task and put in the correct variables. If not, it was skipped. This post is no longer needed. Thank you for your help!

Matthew Reed 0 votes