From 588984a0b93e593f4ac946daf9ddcae9c75e882f Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Wed, 17 Feb 2021 15:05:44 -0600 Subject: [PATCH] Add applyTo to Credentials Allow restricting a credential to a list of actions, just like Parameters can do today. This allows a credential to not have to be passed in for actions that do not use it. Signed-off-by: Carolyn Van Slyck --- 101-bundle-json.md | 7 +++++-- examples/101.02-bundle.json | 3 ++- schema/bundle.schema.json | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/101-bundle-json.md b/101-bundle-json.md index d6765131..f860f0fc 100644 --- a/101-bundle-json.md +++ b/101-bundle-json.md @@ -147,7 +147,8 @@ What follows is an example of a thick bundle. Notice how the `invocationImage` a "path":"/etc/hostkey.txt" }, "image_token":{ - "env":"AZ_IMAGE_TOKEN" + "env":"AZ_IMAGE_TOKEN", + "applyTo": ["install"] }, "kubeconfig":{ "path":"/home/.kube/config" @@ -701,7 +702,8 @@ What about parameters such as database passwords used by the application? Proper }, "image_token": { "env": "AZ_IMAGE_TOKEN", - "required": true + "required": true, + "applyTo": ["install"] }, "kubeconfig": { "path": "/home/.kube/config" @@ -712,6 +714,7 @@ What about parameters such as database passwords used by the application? Proper - The `credentials` container is a map of human-friendly credential names to a description of where the invocation image expects to find them. - The name key MUST be human-readable + - `applyTo`: restricts this credential to a given list of actions. If empty or missing, applies to all actions (OPTIONAL). - `path` describes the _absolute path within the invocation image_ where the invocation image expects to find the credential. Specified path MUST NOT be a subpath of `/cnab/app/outputs`. - `env` contains _the name of an environment variable_ that the invocation image expects to have available when executing the CNAB `run` tool (covered in the next section). - `description` contains a user-friendly description of the credential. diff --git a/examples/101.02-bundle.json b/examples/101.02-bundle.json index f0376a0b..8c4e8e69 100644 --- a/examples/101.02-bundle.json +++ b/examples/101.02-bundle.json @@ -5,7 +5,8 @@ "path": "/etc/hostkey.txt" }, "image_token": { - "env": "AZ_IMAGE_TOKEN" + "env": "AZ_IMAGE_TOKEN", + "applyTo": ["install"] }, "kubeconfig": { "path": "/home/.kube/config" diff --git a/schema/bundle.schema.json b/schema/bundle.schema.json index abb681ad..f17309c9 100644 --- a/schema/bundle.schema.json +++ b/schema/bundle.schema.json @@ -10,6 +10,13 @@ "description": "A user-friendly description of this credential", "type": "string" }, + "applyTo": { + "description": "An optional exhaustive list of actions handling this credential", + "items": { + "type": "string" + }, + "type": "array" + }, "env": { "description": "The environment variable name, such as MY_VALUE, into which the credential will be placed", "type": "string"