Skip to content

add Secret core API - #3272

Merged
vito merged 4 commits into
dagger:cloakfrom
vito:secrets
Oct 11, 2022
Merged

vito merged 4 commits into
dagger:cloakfrom
vito:secrets

Conversation

@vito

@vito vito commented Oct 6, 2022

Copy link
Copy Markdown
Contributor

part of #3178

closes #3183

Unlike the other core API PRs, this is a breaking change as it replaces the old secret schema.

Removed:

core {
  secret(id: SecretID!): String!
  addSecret(plaintext: String!): SecretID!
}

Added:

secret(id: SecretID!): Secret!

container {
  withSecretVariable(name: String!, secret: SecretID!): Container!
  withMountedSecret(path: String!, source: SecretID!): Container!
}

file {
  secret: Secret!
}

This initial PR only supports loading secrets from files, but it has internal scaffolding in place for loading secrets from host env. There just isn't an API representation for it yet, since pulling on that thread leads me to the Host API, which leads to possibly a bunch more work which I'm currently investigating. (tl;dr: Host is a touch point for #3201 as well as the current SDK/plugin infra.)

@netlify

netlify Bot commented Oct 6, 2022 •

Copy link
Copy Markdown

👷 Deploy request for cloak-docs accepted.

Name Link
🔨 Latest commit 23b677c
🔍 Latest deploy log https://app.netlify.com/sites/cloak-docs/deploys/6344d3a2475c620009f33eff

@vito
vito requested review from aluzzardi, shykes and sipsma and removed request for shykes and sipsma October 6, 2022 15:24
@gerhard

gerhard commented Oct 7, 2022

Copy link
Copy Markdown
Contributor

Rebased to make use of the new & beefier runners. Wanted to double-check if the test failure is genuine.

The tests are still failing, so not ready for review just yet.

@vito
vito force-pushed the secrets branch 3 times, most recently from 6bd4f3f to bbfef2e Compare October 8, 2022 02:40
vito added 4 commits October 10, 2022 20:04
secret store now calls back to the gateway and fetches values via
content-addressed SecretIDs

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
@sipsma

sipsma commented Oct 11, 2022

Copy link
Copy Markdown
Contributor

@kpenfound @jpadams Are you or anyone you know relying on the ability to map in secrets w/ CLI calls (i.e. dagger do --secret token=abc ...)? This PR currently removes that, so just checking

@sipsma sipsma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, I just want to hear back about the backwards incompatibility in terms of the CLI interface. If there is a need to support that use case I'd be okay with us adding it back in (it avoids the caching issues since it's always provided by client).

Comment thread core/container.go
return nil, fmt.Errorf("malformed secret config at index %d", i)
}

runOpts = append(runOpts, llb.AddSecret(secretDest, secretOpts...))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: followup issue for some of the other options that users may need for secret mounts (mode, uid gid)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #3323

@vito

vito commented Oct 11, 2022

Copy link
Copy Markdown
Contributor Author

Checked in with @kpenfound on Discord, sounds OK. Going to merge this since a few things are starting to depend on it. Thanks for the review!

For posterity: one migration path from addSecrets is to set secrets as env vars instead and then use host { variable(name: "FOO") { secret { id } } } to retrieve it as a secret.

@vito
vito merged commit 7de4384 into dagger:cloak Oct 11, 2022
@vito
vito deleted the secrets branch October 11, 2022 23:17
@jpadams

jpadams commented Oct 12, 2022

Copy link
Copy Markdown
Contributor

@kpenfound @jpadams Are you or anyone you know relying on the ability to map in secrets w/ CLI calls (i.e. dagger do --secret token=abc ...)? This PR currently removes that, so just checking

Guessing it breaks me: https://github.com/jpadams/dagger-bash-netlify/blob/main/deploy.sh#L19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants