/.github/{actions,scripts,workflows}: initial correctness workflow

This commit is contained in:
Dustin Brown
2021-02-16 17:40:22 -08:00
parent a01f855378
commit 618d430b75
8 changed files with 1828 additions and 1550 deletions
+67
View File
@@ -0,0 +1,67 @@
#!/bin/bash
set -e
if [ -z "$KUBECONFIG" ]; then
echo "Must set KUBECONFIG"
exit 1
fi
if [ -z "$TEMPLATE_SCRIPT" ]; then
echo "Must set TEMPLATE_SCRIPT"
exit 1
fi
if [ -z "$FROM_VERSION" ] && [ -z "$TO_VERSION" ]; then
echo "Must set FROM_VERSION or TO_VERSION for correctness run"
echo "Must set both for regressions run"
exit 1
fi
if [ ! -z "$FROM_VERSION" ] && [ -z "$TO_VERSION" ]; then
echo "Setting TO_VERSION for correctness run"
TO_VERSION="$FROM_VERSION"
fi
if [ -z "$ACTOR" ]; then
echo "Must set ACTOR"
exit 1
fi
if [ -z "$MODE" ]; then
echo "Must set MODE"
exit 1
fi
# use first 8 characters of TO_VERSION to differentiate
# jobs
short=${TO_VERSION:0:8}
lowered=$(echo "$ACTOR" | tr '[:upper:]' '[:lower:]')
actorShort="$lowered-$short"
jobname="$actorShort"
timeprefix=$(date +%Y/%m/%d)
actorprefix="$MODE/$ACTOR/$actorShort"
format="markdown"
if [ "$MODE" = "release" ]; then
format="html"
fi
source "$TEMPLATE_SCRIPT" "$jobname" "$FROM_VERSION" "$TO_VERSION" "$timeprefix" "$actorprefix" "$format" > job.json
KUBECONFIG="$KUBECONFIG" kubectl apply -f job.json
out=$(KUBECONFIG="$KUBECONFIG" kubectl wait job/"$jobname" --for=condition=complete -n sql-correctness --timeout=7200s || true)
if [ "$out" != "job.batch/$jobname condition met" ]; then
echo "output of kubectl wait: $out"
KUBECONFIG="$KUBECONFIG" kubectl logs job/"$jobname" -n sql-correctness
else
echo "::set-output name=object-key::$timeprefix/$actorprefix/correctness-results.log"
KUBECONFIG="$KUBECONFIG" kubectl delete job/"$jobname" -n sql-correctness
fi
exit 0