10

This is a follow-up question to this previous post that doesn't seem like it was ever truly answered with more than a "this looks promising":

Jenkins how to create pipeline manual step.

This is a major functionality gap for CICD pipelines. The current "input step" of declarative (1.2.9) requires the whole pipeline to have to wait for the input step before the pipeline is completed (or have a time-out that won't allow you to re-trigger later). Depending on how agents are scoped it can also hold up an executor or require you to have to start up a new slave for every build step.

This is the closest I've come to a solution that doesn't eat up an executor (pipeline level "agent none" with agents defined in all stages described here: https://jenkins.io/blog/2018/04/09/whats-in-declarative/) but starting a new slave for every build step seems time wasteful and requires additional considerations for persisting your workspace. The final solution offered was to throw a "time-out" for the input, but this still doesn't work because then you can never move that build to stage later and will need to re-build.

Any solutions or suggestions here would be very appreciated.

Ridic
  • 103
  • 1
  • 7
  • Just curious to know if the user input if not entered, do you want to set the result to success and then trigger other job to pick up the artifact of the last successful build and deploy it? – Surendra Deshpande May 09 '18 at 17:19
  • I basically want the pipeline to end after deploying to dev. Then, if they want to promote the build at any point later on they can click the next job and start it (user input) and it will persist any parameters from previous step for that deployment. If they never click it then nothing ever happens and everything is still green and not holding up any executors. This was a pre-existing feature with the manual build step before jenkins scripted pipelines/ declarative. – Ridic May 09 '18 at 17:31
  • So, that input would have what? An approval to promote it? – Surendra Deshpande May 09 '18 at 17:38
  • Another way to think of this... like with the old graphical Jenkins... is that I want to pass parameters to a downstream job- but I don't want to automatically trigger that job without user confirmation. The input is just a go button that triggers the downstream build with the previously passed parameters. – Ridic May 09 '18 at 18:29
  • So what are parameters like? Are mandatory parameters? Can you give a brief explanation about the jobs as well. It will help to understand better. – Surendra Deshpande May 09 '18 at 18:32
  • It's a basic Docker container pipeline that deploys on OpenShift Container Platform. Java/ maven. Once it's deployed in dev environment, if they want to deploy it to their Stage environment, it will need some parameters for the deployment. They're arbitrary, honestly. – Ridic May 09 '18 at 18:39

1 Answers1

0

If you are using Kubernetes Plugin for Jenkins Agent to run as containers in Kubernetes cluster, then there is a setting call idleMinutes.

idleMinutes Allows the pod to remain active for reuse until the configured number of minutes has passed since the last step was executed on it. Use this only when defining a pod template in the user interface.

There you can define your agent at pipeline level without defining it at all stages. (given your agent is designed to have the capabilities run in all stages). When it comes to user input stage, set agent to none at stage level so that it is not holding up the executor.

ouflak
  • 2,458
  • 10
  • 44
  • 49
  • This may be useful for someone looking for solutions with Kubernetes, but it doesn't answer the OP's question. The OP never states what type of containerization they are using. – Nick Allen Feb 10 '22 at 16:22