mibexsoftware / bamboo-plan-dsl-plugin

Configuration as code with a Groovy-based DSL or YAML for Atlassian Bamboo.
https://marketplace.atlassian.com/plugins/ch.mibex.bamboo.plandsl/
Other
40 stars 16 forks source link

Use Shared Credentials authentication for SshTask/ScpTask #79

Open osullivanmc opened 6 years ago

osullivanmc commented 6 years ago

I’m trying to create a deployment project containing SSH and SCP tasks using the authentication type SSH private key with shared credentials.

The DSL task ssh has the methods passwordAuth / keyWithoutPassphrase / keyWithPassphrase for setting the authType to one of these… but not for Shared Credentials.

I thought I could use SharedCredentialsAuth as follows ssh(host: host, userName: username) { description desc bambooFacade.requireSharedCredentials(sharedCredentialsName) authType = new SharedCredentialsAuth(SharedCredentialsAuth.SharedCredentialsType.SSH, sharedCredentialsName, bambooFacade) command sshCommand }

But while this ran and created the tasks, the configuration details were missing (as they wouldn't be returned by SshTask.getConfig) and it resulted in an error in Bamboo java.lang.NullPointerException: Name is null at java.lang.Enum.valueOf(Enum.java:236) at com.atlassian.bamboo.plugins.scp.AuthType.valueOf(AuthType.java:3) at com.atlassian.bamboo.plugins.scp.AuthType.byName(AuthType.java:32)

I can create these using custom tasks, but this requires the sharedCredentialsId instead of name. Also using the custom task for SCP task the artifactToScp is a combination of ids and pattern, which would be better for me to reference by artifactName.

Thanks for your time, M

kchervonets commented 3 years ago

I ran into the same issue. Would be nice to be able to configure shared credentials for ssh/scp tasks.