forked from keptn-sandbox/keptn-on-k3s
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andreas Grabner <[email protected]>
- Loading branch information
1 parent
2808946
commit aae49bd
Showing
4 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v2 | ||
actions: | ||
- name: "Validate Deployment using a Python Script" | ||
events: | ||
- name: "sh.keptn.event.deployment.triggered" | ||
tasks: | ||
- name: "Run bash script" | ||
files: | ||
- /job/validate.triggered.py | ||
env: | ||
- name: SHKEPTNCONTEXT | ||
value: "$.shkeptncontext" | ||
valueFrom: event | ||
- name: SOURCE | ||
value: "$.source" | ||
valueFrom: event | ||
workingDir: "/keptn" | ||
image: "python:3.10" | ||
cmd: ["python3"] | ||
args: ["./job/validate.triggered.py"] |
27 changes: 27 additions & 0 deletions
27
keptn_project_templates/delivery-rollout/job/validate.triggered.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# This is a script that will be executed by the Keptn Generic Executor Service | ||
# It will be called with a couple of enviornment variables that are filled with Keptn Event Details, Env-Variables from the Service container as well as labels | ||
|
||
if [[ "$DATA_VALIDATE_WAITTIME" == "" ]]; then | ||
DATA_VALIDATE_WAITTIME="10s" | ||
fi | ||
|
||
echo "Validate Triggered Script for $DATA_PROJECT.$DATA_STAGE.$DATA_SERVICE" | ||
echo "We are simply waiting for the passed time: $DATA_VALIDATE_WAITTIME" | ||
|
||
sleep "$DATA_VALIDATE_WAITTIME" | ||
|
||
if [[ "$DATA_DEPLOYMENT_DEPLOYMENTURISPUBLIC_0" != "" ]]; then | ||
echo "And now we validate whether we can reach the deployment Url: $DATA_DEPLOYMENT_DEPLOYMENTURISPUBLIC_0" | ||
wget "$DATA_DEPLOYMENT_DEPLOYMENTURISPUBLIC_0" -q -O /dev/null | ||
|
||
if [[ "$?" != "0" ]]; then | ||
echo "wget returned $? - we retry once more!" | ||
sleep "$DATA_VALIDATE_WAITTIME" | ||
echo "Second attempt to validate deployment Url: $DATA_DEPLOYMENT_DEPLOYMENTURISPUBLIC_0" | ||
wget "$DATA_DEPLOYMENT_DEPLOYMENTURISPUBLIC_0" -q -O /dev/null | ||
|
||
echo "wget returned $?" | ||
fi | ||
fi |