File tree Expand file tree Collapse file tree 4 files changed +47
-0
lines changed
main/groovy/javaposse/jobdsl/dsl/helpers/wrapper
test/groovy/javaposse/jobdsl/dsl/helpers/wrapper Expand file tree Collapse file tree 4 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
3232 ([ JENKINS-40797] ( https://issues.jenkins-ci.org/browse/JENKINS-40797 ) )
3333 * Enhanced support for the [ Extra Columns Plugin] ( https://wiki.jenkins-ci.org/display/JENKINS/Extra+Columns+Plugin )
3434 ([ #978 ] ( https://github.com/jenkinsci/job-dsl-plugin/pull/978 ) )
35+ * Enhanced support for the [ SSH Agent Plugin] ( https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin )
36+ ([ #980 ] ( https://github.com/jenkinsci/job-dsl-plugin/pull/980 ) )
37+ * Support for the older versions of the
38+ [ SSH Agent Plugin] ( https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin ) ,
39+ see [ Migration] ( Migration#migrating-to-156 )
3540* 1.55 (January 03 2016)
3641 * Updated optional
3742 [ Config File Provider Plugin] ( https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin ) dependency to
Original file line number Diff line number Diff line change 1+ ## Migrating to 1.56
2+
3+ ### SSH Agent
4+
5+ Support for versions older than 1.5 of the
6+ [ SSH Agent Plugin] ( https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin ) is [[ deprecated|Deprecation-Policy]]
7+ and will be removed.
8+
19## Migrating to 1.55
210
311### ScriptRequest
Original file line number Diff line number Diff line change @@ -186,13 +186,33 @@ class WrapperContext extends AbstractExtensibleContext {
186186 */
187187 @RequiresPlugin (id = ' ssh-agent' )
188188 void sshAgent (String credentials ) {
189+ jobManagement. logPluginDeprecationWarning(' ssh-agent' , ' 1.5' )
189190 Preconditions . checkNotNull(credentials, ' credentials must not be null' )
190191
191192 wrapperNodes << new NodeBuilder (). ' com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper' {
192193 user(credentials)
193194 }
194195 }
195196
197+ /**
198+ * Provide SSH credentials to builds via a ssh-agent in Jenkins.
199+ *
200+ * @param credentials name of the credentials to use
201+ * @since 1.56
202+ */
203+ @RequiresPlugin (id = ' ssh-agent' , minimumVersion = ' 1.5' )
204+ void sshAgent (String ... credentials ) {
205+ Preconditions . checkNotNull(credentials, ' credentials must not be null' )
206+
207+ wrapperNodes << new NodeBuilder (). ' com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper' {
208+ credentialIds {
209+ credentials. each {
210+ string(it)
211+ }
212+ }
213+ }
214+ }
215+
196216 /**
197217 * Renders ANSI escape sequences, including color, to console output.
198218 *
Original file line number Diff line number Diff line change @@ -399,6 +399,20 @@ class WrapperContextSpec extends Specification {
399399 context. wrapperNodes[0 ]. name() == ' com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper'
400400 context. wrapperNodes[0 ]. user[0 ]. value() == ' acme'
401401 1 * mockJobManagement. requirePlugin(' ssh-agent' )
402+ 1 * mockJobManagement. logPluginDeprecationWarning(' ssh-agent' , ' 1.5' )
403+ }
404+
405+ def ' sshAgent with multiple credentials' () {
406+ when :
407+ context. sshAgent(' acme' , ' foo' )
408+
409+ then :
410+ context. wrapperNodes[0 ]. name() == ' com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper'
411+ context. wrapperNodes[0 ]. children(). size() == 1
412+ context. wrapperNodes[0 ]. credentialIds[0 ]. children(). size() == 2
413+ context. wrapperNodes[0 ]. credentialIds[0 ]. string[0 ]. value() == ' acme'
414+ context. wrapperNodes[0 ]. credentialIds[0 ]. string[1 ]. value() == ' foo'
415+ 1 * mockJobManagement. requireMinimumPluginVersion(' ssh-agent' , ' 1.5' )
402416 }
403417
404418 def ' ansiColor with map' () {
You can’t perform that action at this time.
0 commit comments