pipeline {
agent any
environment {
ReleaseTitle = "${ReleaseTitle}".trim()
}
parameters {
activeChoice choiceType: 'PT_SINGLE_SELECT',description: 'Choose the Environment to deploy', filterLength: 1, filterable: false, name: 'Env', randomName: 'choice-parameter-env', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: 'return ["stage","prod"]'])
reactiveChoice choiceType: 'PT_SINGLE_SELECT',description: 'Select false - To build and deploy new image/Select true - To deploy using already relased image tag',filterLength: 1, filterable: false, name: 'DEPLOYONLY', randomName: 'choice-parameter-deployonly', referencedParameters: 'Env', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: '''
if (Env == "prod") {
return ["false","true"]
} else {
return ["NA"]
}
'''])
activeChoiceHtml choiceType: 'ET_FORMATTED_HTML', name: 'ReleaseTitle', omitValueField: true, randomName: 'choice-parameter-releasetitle', referencedParameters: 'DEPLOYONLY', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: '''
ReleaseTitleHtml = \'\'\'
<div style='display: flex; align-items: center;'><label for='releasetitle'></label><input id='releasetitle' name='value' type='text' style='width: 1500px;'></div>
\'\'\'
if (DEPLOYONLY == "false") {
return ReleaseTitleHtml
} else {
return "NA"
}
'''])
activeChoiceHtml choiceType: 'ET_FORMATTED_HTML', name: 'ReleaseComments', omitValueField: true, randomName: 'choice-parameter-releasecomments', referencedParameters: 'DEPLOYONLY', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: '''
ReleaseCommentsHtml = \'\'\'
<div style='display: flex; align-items: center;'><label for='releasecomment'></label><input id='releasecomment' name='value' type='text' style='width: 1500px;'></div>
\'\'\'
if (DEPLOYONLY == "false") {
return ReleaseCommentsHtml
} else {
return "NA"
}'''])
}
stages {
stage('Test') {
steps {
echo "hi"
}
}
}
}
my test pipeline :