From d5e24b21d9773660cc3ac94949ba65548e437ddd Mon Sep 17 00:00:00 2001 From: RealAnna <89971034+RealAnna@users.noreply.github.com> Date: Tue, 13 Jun 2023 15:28:56 +0200 Subject: [PATCH] chore: add example for python task definition (#1554) Signed-off-by: realanna --- .../taskdefinition_pyfunction_recursive.yaml | 11 +++++++ ...taskdefinition_pyfunction_use_envvars.yaml | 31 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml create mode 100644 operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml diff --git a/operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml b/operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml new file mode 100644 index 0000000000..2d6b35b8de --- /dev/null +++ b/operator/config/samples/python_execution/taskdefinition_pyfunction_recursive.yaml @@ -0,0 +1,11 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTaskDefinition +metadata: + name: scheduled-deployment-2 +spec: + python: + parameters: + map: + mydata: "my-other-data" + functionRef: + name: scheduled-deployment-inline diff --git a/operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml b/operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml new file mode 100644 index 0000000000..0b5206991a --- /dev/null +++ b/operator/config/samples/python_execution/taskdefinition_pyfunction_use_envvars.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Secret +metadata: + name: mysecret +type: Opaque +data: + SECURE_DATA: dG9rZW46IG15dG9rZW4= +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTaskDefinition +metadata: + name: pre-deployment-hello + annotations: + python: test +spec: + python: + parameters: + map: + user: "myuser" + secureParameters: + secret: mysecret + cmdParameters: "-h" + inline: + code: | + import os + import yaml + data = os.getenv('DATA') + dct = yaml.safe_load(data) + USER= dct['user'] + PASSWORD = os.environ.get('SECURE_DATA') + print(USER,PASSWORD)