From bb06f5236f7731b612d5b591c21467d1a34bb4d4 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Mon, 27 Nov 2023 12:04:13 +0100 Subject: [PATCH] docs: mention `KEPTN_CONTEXT` env var in runtime readmes files Signed-off-by: Florian Bacher --- runtimes/deno-runtime/README.md | 15 +++++++++++---- runtimes/python-runtime/README.md | 8 ++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/runtimes/deno-runtime/README.md b/runtimes/deno-runtime/README.md index 3dec2525e4..bf5bebe51e 100644 --- a/runtimes/deno-runtime/README.md +++ b/runtimes/deno-runtime/README.md @@ -12,17 +12,24 @@ The Keptn deno runtime uses [Deno](https://deno.com/) to execute Javascript/Typescript code. Keptn uses this runtime to run [KeptnTask](https://lifecycle.keptn.sh/docs/tasks/write-tasks/) for pre- and post-checks. -Keptn passes parameters of `KeptnTask`s and -[Context](https://lifecycle.keptn.sh/docs/concepts/tasks/#context) information -to the runtime via the special environmental variable `DATA`. -It also supports mounting Kubernetes secrets making them accessible via the `SECURE_DATA` env var. + +### Environment Variables + +Keptn passes the following environment variables to the runtime: + +* `DATA`: JSON encoded object containing the parameters specified in `spec.parameters` of a `KeptnTask`. +* `SECURE_DATA`: Contains the value of the secret referenced in the `spec.secureParameters` field of a `KeptnTask`. +* `KEPTN_CONTEXT`: JSON encoded object containing context information for the task. + You can then read the data with the following snippet of code. ```js const data = Deno.env.get("DATA")!; const secret = Deno.env.get("SECURE_DATA")!; +const context = Deno.env.get("KEPTN_CONTEXT")!; console.log(data); console.log(secret); +console.log(context); ``` `KeptnTask`s can be tested locally with the runtime using the following command. diff --git a/runtimes/python-runtime/README.md b/runtimes/python-runtime/README.md index ca64db829a..c2fc2a5535 100644 --- a/runtimes/python-runtime/README.md +++ b/runtimes/python-runtime/README.md @@ -69,3 +69,11 @@ docker run -e "SCRIPT=https://raw.githubusercontent.com/keptn/lifecycle-toolkit/ + +### Environment Variables + +Keptn passes the following environment variables to the runtime: + +* `DATA`: JSON encoded object containing the parameters specified in `spec.parameters` of a `KeptnTask`. +* `SECURE_DATA`: Contains the value of the secret referenced in the `spec.secureParameters` field of a `KeptnTask`. +* `KEPTN_CONTEXT`: JSON encoded object containing context information for the task.