-
Notifications
You must be signed in to change notification settings - Fork 231
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
Declarative secrets #198
Comments
Would an optional boolean |
If a secret represents an external API key, then it might be helpful to allow the repo maintainer to include the URL to retrieve it. That way, the experience feels as actionable as possible (e.g. "You need this secret and here's where to get it!"). I could imagine that being enabled by allowing the |
I had planned for our descriptions to just allow HTML snippets and run them through some sanitization in Rails-land. Markdown would also be fine. See the (terrible MVP-only) UI mock here: https://github.com/github/codespaces/issues/12175 |
I assume this is for the devcontainer.json? Would the devcontainer-feature.json also support the declaration of secrets? Would they go into the image metadata? Not every UI might be able to or allow for rendering Markdown / HTML (e.g., VS Code's QuickPick UI). We could keep the description plain-text and add an optional I suggest we use a JSON object mapping secret names to their properties, that will align well with existing properties like "secrets": {
"MY_SECRET": {
"description": "This is a great description of MY_SECRET."
}
}, Instead of making secrets implicitly part of the environment variables, we could use a similar syntax to the one we are using, e.g., to include local variables {
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
"secrets": {
"MY_SECRET": {
"description": "This is a great description of MY_SECRET."
}
},
"remoteEnv": {
"MY_SECRET": "${secret:MY_SECRET}",
"SOME_VARIABLE": "${localEnv:SOME_VARIABLE}"
},
"features": {
"ghcr.io/devcontainers/features/my_feature:1": {
"version": "latest",
"accessToken": "${secret:MY_SECRET}"
}
}
} |
@chrmarti I think by precedent, the secrets should be injected as environment variables by default. We could have a That said, everything else makes sense to me. |
Ok, so here's the current proposal summary after a few other conversations:
{
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
"secrets": {
"MY_SECRET": {
"description": "I will show up as an env var.",
"type": "environmentVariable" // The default
},
"MY_NON_ENV_SECRET": {
"description": "I will not show up as an env var.",
"type": "reference"
}
},
"features": {
"ghcr.io/devcontainers/features/my_feature:1": {
"version": "latest",
"accessToken": "${secret:MY_NON_ENV_SECRET}"
}
}
} Seem workable? |
@Chuxel I don't think most of that impacts us directly on Codespaces so that seems fine to me. Just to clarify a minimal implementation for Codespaces would now look something like this correct?
|
Yeah this should get added to the devcontainers CLI as a reference implementation, which would allow all those things to work. But an implementation outside of the CLI could start with just that, yes. There's a spot for tool/service specific features and and limitations we can add it to in containers.dev. |
@bamurtaugh with the proposal merged do we close this issue now? |
@bdmac Yes! And then you open a new issue labeled I'd also recommend sharing the finalization issue in the community Slack channel for greater awareness. |
@bamurtaugh I opened #216 for |
Thanks! I'll add it for you. |
Not entirely sure if this also applies but we intend to use Doppler (link) which is responsible for managing our environment variables. Right now, the problem is that we have to pass a Token as an environment variable which allows the container to obtain the environment variables needed for the container to operate.
If the above does not happen, then we have to explicitly pass the token to the devcontainer.json and manually generate a new token every now and then, risking having the token submitted to our git repo which is not great. Questions:
Thanks! |
For 2. |
I think this might do the trick... I'll try it tomorrow! Thanks |
Proposal
Allow secrets to be declared in devcontainer outlining requirements to successfully run the container. All declared secrets in this initial specification would be injected into the container as ENV variables.
Declared secrets would be recommendations not requirements. Missing secrets should not prevent creation of the container.
Example
Related to https://github.com/github/codespaces/issues/12040
The text was updated successfully, but these errors were encountered: