Home Add gitparameter in jenkins pipeline
Reply: 0

Add gitparameter in jenkins pipeline

user788 Published in April 27, 2018, 6:43 am

I need the userInput when executing the pipeline. The input will be the git branch of a particular repository. As we can configure gitparameter in the jenkins job how do we configure it in the jenkins pipeline. I have got the pipeline code as follows >

   stage 'promotion'
   def userInput = input(
   id: 'userInput', message: 'Let\'s promote?', parameters: [
   [$class: 'GitParameterDefinition', description: 'Environment', name: 'env',type: 'Branch'],
   [$class: 'TextParameterDefinition', defaultValue: 'uat1', description: 'Target', name: 'target']
  echo ("Env: "+userInput['env'])
  echo ("Target: "+userInput['target'])

All I get is an empty input box how do I configure it with the git repository in the pipeline itself.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.329143 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO