How to: Trigger sub-release of template with value provider input in Release

Question

I have a template that has input variables (showed on Create Release form) determined by a value provider. I want to trigger this template from another template, as a sub-release, by using the Core > Create Release task.

In this task, after selecting the template, the input variables appear. The problem is that for the ones that are value providers, I can't use a variable as input. I can only select a value from the dropdown directly in the Create Release task.

Answer

The workaround for the issue is using the script below to assign values to the create release task:

from com.xebialabs.xlrelease.domain.variables import StringVariable

task = taskApi.searchTasksByTitle('Application deployment', 'Deployment', getCurrentRelease().
id)[0]

application = StringVariable()
environment = StringVariable()

application.setKey('application')
application.setValue(releaseVariables['application'])
environment.setKey('environment')
environment.setValue(releaseVariables['environment'])

task.templateVariables = [application, environment]
taskApi.updateTask(task.id, task)

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.