Skip to content

Commit

Permalink
docs: mention KEPTN_CONTEXT env var in runtime readmes files
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Bacher <[email protected]>
  • Loading branch information
bacherfl committed Nov 27, 2023
1 parent 9ee4583 commit bb06f52
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 @@ -69,3 +69,11 @@ docker run -e "SCRIPT=https://raw.githubusercontent.com/keptn/lifecycle-toolkit/

<!-- markdownlint-disable-next-line MD033 MD013 -->
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=858843d8-8da2-4ce5-a325-e5321c770a78" />

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

Please sign in to comment.