4

I have a powershell script I uses for daily releases which works fine. However, I am tasked to run this from Jenkins but I cannot seem to get the parameterised build to work. These are the steps the script takes to do a deployment.

  1. Deploy to PRE_UAT environment.
  2. Test Step 1
    i. If step 1 is successful, ask user if they want to proceed to deploy to UAT
        a. If user response is positive, proceed to deploy to UAT else Stop
    ii. If Step 1 is unsuccessful, Inform User and Stop

The first job runs successfully in Jenkins but the second job which is a parameterised build does not request for user input when triggered by the first build. Only the first job (which is also a parameterised build) prompts for user input.

Thanks

seenukarthi
  • 8,241
  • 10
  • 47
  • 68
George France
  • 43
  • 1
  • 3

2 Answers2

6

There is no guarantee to have a user (or the 'right' user) in front of jenkins when the second build get triggered. Build parameters will not be requested when a build is not triggered manually.

I would recommend you look at the promotion plugin, and maybe try to set up a manual promotion step after the first build that will trigger the second one.

ptyx
  • 4,074
  • 1
  • 19
  • 21
  • 1
    The first build is also parameterised a requires user input. It also takes seconds to run so there is a guarantee of a user initiating the build manually. I will have a look at the [https://wiki.jenkins-ci.org/display/JENKINS/Promoted+Builds+Plugin] (promotion plugin) – George France Jan 03 '13 at 17:39
  • Then what you could do is parameterize the first build with something like "run second one if first one passes". But ultimately, what you're doing is promotion - and the plugin does a good job with that kind of workflow. – ptyx Jan 03 '13 at 18:13
  • Thanks ptyx. Having read up on the promotion plugin, I think that is what I need. Thanks a lot! – George France Jan 07 '13 at 17:29
0

You can pass a parameter from the first step to the next, and so on,
but it will not give the flow you are aiming at. (the user can't know at the beginning of the build if he will want to promote it or not).

Suggest you check the promotion plugin.

Gonen
  • 4,005
  • 1
  • 31
  • 39
  • My point is, after the first successful build, I still need the user to decide whether to do the second build or not. In the powershell script, after the first successful build, User have three options. 1. Re-Run first Build, 2.Run second Build or 3. Abort second build. – George France Jan 04 '13 at 16:34
  • Well, as @ptyx explained, you cannot stop a batch-job in the middle - either you set a rule that allows the script to decide, or break to process to parts and have the user choose what to run and when. – Gonen Jan 05 '13 at 09:36