Answer the question
In order to leave comments, you need to log in
Hudson/Jenkins parameterized builds
Good day!
I ask for advice in creating a task for the above CIs.
There are 3 instances: Test, Stage and Production.
For the deployment of each of them there is a task in CI.
To optimize their execution, I rewrote the scripts in powershell and created a single task for everyone.
In this regard, it became necessary when starting the build, you need to select an instance from the drop-down list and subsequently pass 3 parameters depending on this choice.
For example, when selecting the Test instance, pass parameters: svn=path.to.svn1, url=http://url1, server=server1
When selecting Stage: svn=path.to.svn2, url=http://url2, server= server2
etc.
Share your experience, how can this be done?
Answer the question
In order to leave comments, you need to log in
There is a contact, earned!
Thanks to scrutari for the kick in the right direction.
In general, if anyone is interested, Powershell reads variables from Jenkins only in this form: $ env:
VARIABLE I did not find information about this anywhere, I had to select it by typing.
Now the problem is different...
Here is part of the PS script:
$instancename = %instance%
if ($instancename -eq "stage.domain.com") {
$host = "stage-host"
$www = "stage.localhost"
}
elseif ($ instancename -eq "test.domain.com") {
$host = "test-host"
$www = "test.localhost"
}
Powershell stubbornly refuses to read %instance%
%instance%: The term '%instance%' is not recognized as the name of a cmdlet
Tried to change to $instance - effect 0.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question