Have you considered making the job which deploys to Stage or to Prod a parameterized job, with the credentials as the parameter? I think your batch file could then reference the credentials which were passed as job parameters.
https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build Possibly also may want https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin Mark Waite >________________________________ > From: JenkinsUser <vijendra.1...@gmail.com> >To: jenkinsci-users@googlegroups.com >Sent: Saturday, October 20, 2012 5:39 AM >Subject: Need help on automating QA, Stage, Prod delpoy > > >Hi, >We are using Hudson as a CI tool. At present we are needed to use Jenkins, to >deploy the build to Stage, Prod environment. What is the best aproach we >should follow. >I know about promote buld plugin, but the issue is authentication. I want >whevener we need to promote a build to deploy to Stage or Prod, it should ask >for netqwork credential first. And then the promote job should execute the >Batch command using the creadential supplied. At present, the promote plugin, >runs using the credentials which the Tomcat server is configured to run. >Same issue with Build Pipeline plugin. >I want only dev or even hudson admin also should not be able to execute the >promote build unless credential supplied. (We have windows 2008 r2 OS) >Can you please help me in resolving the issue. so that basically whenever a >user click on Promote build to QA\Stage\Prod the plugin should ask for >credential or should use the logged on users credential and execute the batch >script using the logged users credential only and not by using the credentials >of the account with which the tomcat server is configured. >Can you please help me? >Please suggests us the best aproach for making automated build on prod\stage. > >