jervis icon indicating copy to clipboard operation
jervis copied to clipboard

Use Jenkins Credentials inside Jervis

Open byjg opened this issue 6 years ago • 4 comments

The Jervis documentation mentions "secrets". I see examples here: https://github.com/samrocketman/jervis-secrets-test

But, for use this solution I have to write in the .jervis.yml the secret text. Is there anyway to get a jenkins credentials directly from inside the Jervis?

I imagine something like this:

jenkins:
  credentials:
      - MY_SECRET_TEXT: id_jenkins_secret_text
      - MY_SECRET_USER: id_jenkins_secret_user.USERNAME
      - MY_SECRET_PASSWORD: id_jenkins_secret_user.PASSWORD

byjg avatar Apr 26 '18 11:04 byjg

I’ll consider it to core. However, you can add your own custom workflow library that has an adminSecretsMap var. it would be a key value pair which gets hidden from the console output and injected as environment variables.

https://github.com/samrocketman/jervis/blob/264312a267460133d92adf21aff4dbbbc1564298/vars/buildViaJervis.groovy#L311

For now, no immediate plans.

This extension was added so admins can add any arbitrary secrets support they like via their own groovy code.

samrocketman avatar Apr 26 '18 15:04 samrocketman

I have to install the "Global Variable String Parameter" and it worked. I can setup a variable and use it inside the .jervis.yml.

This plugin could be in the "jenkins-bootstrap-shared" project

byjg avatar Apr 27 '18 03:04 byjg

I'd rather limit plugins to only those essential to core logic at this time. I don't see myself using that plugin. I may expand the plugins to include metrics as well.

Building your own custom fork of the bootstrapper should be fairly easy. Just a matter of you bootstrapping to the UI. Installing the plugins, and then saving the installed plugins via the bootstrap scripts to generate a new dependencies.gradle.

samrocketman avatar Apr 27 '18 06:04 samrocketman

Thanks! It helped a lot!

byjg avatar Apr 27 '18 14:04 byjg