Skip to content

Commit

Permalink
docs: mention KEPTN_CONTEXT env var in runtime readmes files (keptn…
Browse files Browse the repository at this point in the history
…#2588)

Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: David Ahmadov <[email protected]>
  • Loading branch information
bacherfl authored and ahmedavid committed Dec 6, 2023
1 parent 6e2c928 commit d668faa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
15 changes: 11 additions & 4 deletions runtimes/deno-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions runtimes/python-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,11 @@ We can call the hellopy.py script downloading it directly from github
```shell
docker run -e "SCRIPT=https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/runtimes/python-runtime/samples/hellopy.py" -it lifecycle-toolkit/runtimes/python-runtime:${VERSION}
```

### 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.

0 comments on commit d668faa

Please sign in to comment.