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

Provide list of injected secrets in environment variables #2088

Closed
bradrydzewski opened this issue Jun 23, 2017 · 5 comments
Closed

Provide list of injected secrets in environment variables #2088

bradrydzewski opened this issue Jun 23, 2017 · 5 comments
Projects

Comments

@bradrydzewski
Copy link

Plugin authors would like the ability to see a list of injected secrets. The proposal is that we would provide a PLUGIN_SECRETS environment variable that would include a comma-separated list of secrets passed to that plugin.

So for the below yaml:

docker:
  image: plugins/docker
  repo: octocat/hello-world
  secrets: [docker_username, docker_password]

the docker plugin would receive the following environment variables:

PLUGIN_SECRETS=DOCKER_USERNAME,DOCKER_PASSWORD

cc @stephansnyt @dellintosh

@bradrydzewski bradrydzewski added this to the v1.0.0 milestone Jun 23, 2017
@dellintosh
Copy link

dellintosh commented Jun 24, 2017

In the drone-marathon plugin we would like to inject secrets into the marathon.json file in order to leverage the Drone secret store. Since these values can be dynamic (unlike the DOCKER_USERNAME, for example), the plugin cannot be hard-coded with those secret names.

If the plugin could get a list of secrets then it can load those values from the environment by name and inject them into the marathon.json file without requiring additional configuration in the .drone.yml file.

in .drone.yml:

marathon:
  image: e20co/drone-marathon
  repo: octocat/hello-world
  secrets: [octocat_password, db_url, detonation_code]

in marathon.json:

...
  "env": {
    "SYSTEM_PASSWORD": "<<OCTOCAT_PASSWORD>>",
    "DATABASE_URI": "<<DB_URL>>",
    "DETONATION": "<<DETONATION_CODE>>"
  }
...

@bradrydzewski bradrydzewski added this to To Do in Version 0.8 Jun 24, 2017
@stephansnyt
Copy link

stephansnyt commented Jun 28, 2017

@dellintosh I think this change would enable that.

I think the following would be a work-around for now: manually creating something like the PLUGIN_SECRETS variable until the change is implemented where drone does it automatically.

in .drone.yml:

marathon:
  image: e20co/drone-marathon
  repo: octocat/hello-world
  secret_names:
    - OCTOCAT_PASSWORD
    - DB_URL
    - DETONATION_CODE
  secrets: [octocat_password, db_url, detonation_code]

or even something like

secret_names: "OCTOCAT_PASSWORD,DB_URL,DETONATION_CODE"

@dellintosh
Copy link

@stephansnyt so you know, the latest version of drone-marathon has a values list which does essentially that. See the updated docs at http:https://plugins.drone.io/e20co/drone-marathon/ for details. This fix would essentially remove the need for the extra list, so that secrets would be automatically included. ;)

@bradrydzewski bradrydzewski removed this from To Do in Version 0.8 Jun 30, 2017
@bradrydzewski bradrydzewski removed this from the v1.0.0 milestone Jul 16, 2017
@tonglil
Copy link

tonglil commented Aug 14, 2017

@bradrydzewski I would like to tackle this if it's not WIP already.
I assume the work is to be done somewhere in cncd/pipeline?
https://github.com/cncd/pipeline/blob/master/pipeline/frontend/metadata.go#L96

@bradrydzewski
Copy link
Author

bradrydzewski commented Oct 5, 2017

The code for this capability is in place, and will be included in 0.9. Variable name is DRONE_SECRETS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

4 participants