sbt-release and Credentials Plugin

435 views
Skip to first unread message

mikelenner

unread,
May 20, 2015, 9:17:04 AM5/20/15
to jenkins...@googlegroups.com
Hello - 

I'm using the Credentials Plugin to manage jenkin's access to git. This works fine and integrates well with the Jenkins Git Plugin.

However, I'm running an sbt build that uses the sbt-release plugin to add commits, tag, and push those changes to the origin repo. I have this setup as an "Execute Shell" build step. My problem is getting the sbt build to leverage the Credentials Plugin. 

Feels like the right path is to use the Credentials Binding Plugin which allows you to inject the credentials as environment variables. But, I haven't been able to progress any further. Anyone already do this?

Thanks,
Mike

mikelenner

unread,
May 20, 2015, 11:14:09 AM5/20/15
to jenkins...@googlegroups.com
I solved this myself.
  1. Use Credentials Binding Plugin to inject the git creds into two environment variables - GIT_USER and GIT_PASSWORD
  2. Before the sbt build, use a shell build step to get the creds into a git credential.helper store. E.g.:

    git config --local credential.helper 'store --file=/tmp/jenkins/.gitcreds'
    git fetch https
    ://$GIT_USER:$GIT_PASSWORD@[repo url]
(Note that the credentials are stored in plain text in the file you designate)
Reply all
Reply to author
Forward
0 new messages