mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-28 04:28:53 -05:00
/.github/{scripts,workflows}: fix, pod to job, handle pod errors
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$#" -ne 5 ]; then
|
||||
echo "Usage: ./get-job-json.sh <jobname> <fromVersion> <toVersion> <timeprefix> <actorprefix>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jobname="$1"
|
||||
fromVersion="0.22.5"
|
||||
toVersion="0.22.6"
|
||||
timeprefix="$4"
|
||||
actorprefix="$5"
|
||||
|
||||
echo '
|
||||
{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "Job",
|
||||
"metadata": {
|
||||
"name": "'$jobname'",
|
||||
"namespace": "performance-benchmarking"
|
||||
},
|
||||
"spec": {
|
||||
"backoffLimit": 2,
|
||||
"template": {
|
||||
"spec": {
|
||||
"serviceAccountName": "performance-benchmarking",
|
||||
"containers": [
|
||||
{
|
||||
"name": "performance-benchmarking",
|
||||
"image": "407903926827.dkr.ecr.us-west-2.amazonaws.com/liquidata/performance-benchmarking:latest",
|
||||
"args": [
|
||||
"--from-version='$fromVersion'",
|
||||
"--to-version='$toVersion'",
|
||||
"--bucket=performance-benchmarking-github-actions-results",
|
||||
"--results-dir='$timeprefix'",
|
||||
"--results-prefix='$actorprefix'",
|
||||
"select * from from_results;",
|
||||
"select * from to_results;"
|
||||
]
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$#" -ne 5 ]; then
|
||||
echo "Usage: ./get-pod-spec-json <podname> <fromVersion> <toVersion> <timeprefix> <actorprefix>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
podname="$1"
|
||||
fromVersion="$2"
|
||||
toVersion="$3"
|
||||
timeprefix="$4"
|
||||
actorprefix="$5"
|
||||
|
||||
echo '
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Pod",
|
||||
"metadata": {
|
||||
"name": "'$podname'",
|
||||
"namespace": "performance-benchmarking"
|
||||
},
|
||||
"spec": {
|
||||
"serviceAccountName": "performance-benchmarking",
|
||||
"containers": [
|
||||
{
|
||||
"name": "performance-benchmarking",
|
||||
"image": "407903926827.dkr.ecr.us-west-2.amazonaws.com/liquidata/performance-benchmarking:latest",
|
||||
"args": [
|
||||
"--from-version='$fromVersion'",
|
||||
"--to-version='$toVersion'",
|
||||
"--bucket=performance-benchmarking-github-actions-results",
|
||||
"--results-dir='$timeprefix'",
|
||||
"--results-prefix='$actorprefix'",
|
||||
"select * from from_results;",
|
||||
"select * from to_results;"
|
||||
]
|
||||
}
|
||||
],
|
||||
"restartPolicy": "OnFailure"
|
||||
}
|
||||
}
|
||||
'
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/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 and TO_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$ACTOR" ]; then
|
||||
echo "Must set ACTOR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Setting from version to: $FROM_VERSION"
|
||||
echo "Setting to version to: $TO_VERSION"
|
||||
|
||||
jobname="performance-benchmarking-$ACTOR"
|
||||
|
||||
timeprefix=$(date +%Y/%m/%d)
|
||||
|
||||
actorprefix="$ACTOR/$TO_VERSION"
|
||||
|
||||
source "$TEMPLATE_SCRIPT" "$jobname" "$FROM_VERSION" "$TO_VERSION" "$timeprefix" "$actorprefix" > job.json
|
||||
|
||||
KUBECONFIG="$KUBECONFIG" kubectl apply -f job.json
|
||||
|
||||
errors=$(KUBECONFIG="$KUBECONFIG" kubectl wait job/"$jobname" --for=condition=complete -n performance-benchmarking --timeout=400s 2>&1 || true)
|
||||
|
||||
if [ -z "$errors" ]; then
|
||||
KUBECONFIG="$KUBECONFIG" kubectl delete job/"$jobname" -n performance-benchmarking
|
||||
echo "::set-output name=object-key::$timeprefix/$actorprefix/compare-results.log"
|
||||
exit 0
|
||||
else
|
||||
KUBECONFIG="$KUBECONFIG" kubectl logs job/"$jobname" -n performance-benchmarking
|
||||
exit 1
|
||||
fi
|
||||
@@ -85,26 +85,32 @@ jobs:
|
||||
echo "Setting from version to: $FROM_VERSION"
|
||||
echo "Setting to version to: $TO_VERSION"
|
||||
|
||||
uuid=$(uuidgen)
|
||||
podname="performance-benchmarking-$uuid"
|
||||
jobname="performance-benchmarking-$ACTOR"
|
||||
|
||||
timeprefix=$(date +%Y/%m/%d)
|
||||
|
||||
actorprefix="$ACTOR/$TO_VERSION"
|
||||
|
||||
./.github/scripts/performance-benchmarking/get-pod-spec-json.sh "$podname" "$FROM_VERSION" "$TO_VERSION" "$timeprefix" "$actorprefix" > pod.json
|
||||
./.github/scripts/performance-benchmarking/get-job-json.sh "$jobname" "$FROM_VERSION" "$TO_VERSION" "$timeprefix" "$actorprefix" > job.json
|
||||
|
||||
KUBECONFIG=kubeconfig kubectl apply -f pod.json
|
||||
KUBECONFIG=kubeconfig kubectl apply -f job.json
|
||||
|
||||
while [[ $(KUBECONFIG=kubeconfig kubectl get pod/"$podname" -n performance-benchmarking -o 'jsonpath={..status.conditions[?(@.type=="Ready")].reason}') != "PodCompleted" ]]; do echo "waiting for pod" && sleep 60; done
|
||||
errors=(KUBECONFIG=kubeconfig kubectl wait job/"$jobname" --for=condition=complete -n performance-benchmarking --timeout=400s 2>&1 || true)
|
||||
|
||||
KUBECONFIG=kubeconfig kubectl delete pod/"$podname" -n performance-benchmarking
|
||||
|
||||
echo "::set-output name=object-key::$timeprefix/$actorprefix/compare-results.log"
|
||||
if [ -z "$errors" ]; then
|
||||
KUBECONFIG=kubeconfig kubectl delete job/"$jobname" -n performance-benchmarking
|
||||
echo "::set-output name=object-key::$timeprefix/$actorprefix/compare-results.log"
|
||||
exit 0
|
||||
else
|
||||
KUBECONFIG=kubeconfig kubectl logs job/"$jobname" -n performance-benchmarking
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
FROM_VERSION: ${{ github.sha }}
|
||||
TO_VERSION: ${{ steps.comment-branch.outputs.head_sha }}
|
||||
ACTOR: ${{ github.actor }}
|
||||
# KUBECONFIG: "./kubeconfig"
|
||||
# TEMPLATE_SCRIPT: "./.github/scripts/performance-benchmarking/get-job-json.sh"
|
||||
- name: Get benchmark results
|
||||
run: |
|
||||
echo "Get benchmark results here: $KEY"
|
||||
|
||||
Reference in New Issue
Block a user