Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-58563

Restrict Pipeline submitter from deploying to Dev

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline
    • None
    • Dev

      stage('ApprovalStep'){stage('ApprovalStep'){      
      when

      {            expression \{ BRANCH_NAME == 'master' }

      }
                 

      steps{               
      script{            
      def IS_APPROVED = input(                           
      message: "Approve Deployment?"                           
      ok: "Deploy"                           
      submitter: "user1,user2,user3"                           
      parameters [                            string(name: 'IS_APPROVED', defaultValue: 'Deploy', description: 'Deploy to master?')
      ]
      if((params.Selected_Env)=='master')
      {                           
      echo 'Production'                           
      echo " workspace  ${PWD}"                            
      sh "${run_cmd} ${run_cmd_option} ${run_cmd_option_mule} -P arm -Dmule.version=${run_mule_version_prod_01_val} -Dtarget=${run_target_prod_01} -Dtarget.type=${run_target_value_01} -Dusername=${deploy_un} -Dpassword=${deploy_un_pwd} -Denvironment=Prod" } )        
      if (IS_APPROVED != 'Deploy')

      {                            currentBuild.result = "ABORTED"                            error "User cancelled"                            }

                          }                }    }

            Unassigned Unassigned
            sravipati0828 SRIKANTH RAVIPATI
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: