This commit is contained in:
@@ -18,6 +18,45 @@ steps:
|
|||||||
branch: release
|
branch: release
|
||||||
event: push
|
event: push
|
||||||
|
|
||||||
|
migrate:
|
||||||
|
image: bitnami/kubectl:latest
|
||||||
|
volumes:
|
||||||
|
- /home/future2/Studio_v2/woodpecker/kube/config:/tmp/kubeconfig:ro
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
set -eu
|
||||||
|
commit="$(printf %.8s "$CI_COMMIT_SHA")"
|
||||||
|
job="studio-auth-migrate-$commit"
|
||||||
|
kubectl --kubeconfig=/tmp/kubeconfig -n studio-system delete job "$job" --ignore-not-found
|
||||||
|
cat <<EOF | kubectl --kubeconfig=/tmp/kubeconfig apply -f -
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: $job
|
||||||
|
namespace: studio-system
|
||||||
|
spec:
|
||||||
|
backoffLimit: 1
|
||||||
|
ttlSecondsAfterFinished: 600
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
containers:
|
||||||
|
- name: migrate
|
||||||
|
image: localhost:5000/studio-auth-be:0.1.1
|
||||||
|
imagePullPolicy: Always
|
||||||
|
command: ["sh", "-lc", "bunx --no-install prisma migrate deploy"]
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: studio-auth-be-env
|
||||||
|
EOF
|
||||||
|
if ! kubectl --kubeconfig=/tmp/kubeconfig -n studio-system wait --for=condition=complete "job/$job" --timeout=180s; then
|
||||||
|
kubectl --kubeconfig=/tmp/kubeconfig -n studio-system logs "job/$job" --all-containers=true || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
when:
|
||||||
|
branch: release
|
||||||
|
event: push
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
image: bitnami/kubectl:latest
|
image: bitnami/kubectl:latest
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user