Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CredentialsPlugin should be applied to every Stage, not just BuildStage #192

Closed
dkolb opened this issue Feb 14, 2020 · 3 comments
Closed
Labels
enhancement New feature or request
Milestone

Comments

@dkolb
Copy link
Contributor

dkolb commented Feb 14, 2020

Overview

Currently Credentials Plugin only supports the build stage and Username/Password credentail types.

The current use case I have requires mapping credentials onto TF_VAR_blah environment variables in the environment stages. Furthermore, some of these credentials are of the string() type of DSL call. Finally, some of these credentials differ between individual environment stage.

Current Workarounds

Currently I'm moving to decorating each stage directly in the Jenkinsfile for now.

def validate   = new TerraformValidateStage()
def deployDev  = new TerraformEnvironmentStage('dev')

deployDev.decorate(TerraformEnvironmentStage.ALL, { closure ->
  withCredentials([
    usernamePassword(
      credentialsId: 'some-user'
      usernameVariable: 'TF_VAR_some_user',
      passwordVariable: 'TF_VAR_some_passord'
    ),
    string(
      credentialsId: 'some-secret',
      variable: 'TF_VAR_some_secret'
    )
  ]) {
    closure()
  }
})

validate
  .then(deployDev)
  .build()
@dkolb dkolb added the enhancement New feature or request label Feb 14, 2020
@brobbins0
Copy link

+1 - Need to be able to use CredentialsPlugin on RegressionStage

@kmanning
Copy link
Collaborator

kmanning commented Apr 7, 2020

This sounds like at least 3 separate issues:

  1. CredentialsPlugin should be applied to every Stage
  2. It should be possible to set unique credentials for different instances of a Stage.
  3. Credentials other than username/password should be supported

@kmanning
Copy link
Collaborator

kmanning commented Apr 8, 2020

Of the 3 issues outlined above, the first is taken care of with the above PR/Merge.

Thinking through the second (unique credentials per Environment), that seems a little tricky. There's already a "pattern" for environment-specific configuration for plugins like the S3BackendBucket, but I don't think that pattern fits well with the UseCase here.

I'm gonna break 2 and 3 out into separate issues, so that the first (CredentialsPlugin should be applied to every Stage) can be released sooner.

@kmanning kmanning changed the title CredentialsPlugin: Support for environment stages, string, per-stage CredentialsPlugin should be applied to every Stage, not just BuildStage Apr 8, 2020
@kmanning kmanning closed this as completed Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants