-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dump script from sync (#395)
- Loading branch information
Showing
2 changed files
with
41 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
# Set kube context | ||
# kubectl config use-context ,,, | ||
|
||
# Set kube context namespace | ||
# kubectl config set-context --current --namespace=,,, | ||
|
||
# Set file | ||
FILE=fixtures | ||
|
||
# Set source env | ||
SRC_ENV=api-prod | ||
|
||
# Get source pod | ||
SRC_POD=$(kubectl get po -l app.kubernetes.io/name=$SRC_ENV -o name | \ | ||
sed "s/^.\{4\}//" | \ | ||
head -n 1\ | ||
) | ||
|
||
# Dump fixtures in source pod | ||
kubectl exec $SRC_POD -- /bin/bash -c "\ | ||
python manage.py dumpfixture --output $FILE.json && \ | ||
tar -czvf $FILE.tar.gz $FILE.json\ | ||
" | ||
|
||
# Copy fixtures from source pod | ||
kubectl cp $SRC_POD:/app/$FILE.tar.gz ./$FILE.tar.gz | ||
|
||
# Remove fixtures from pod | ||
kubectl exec $SRC_POD -- rm $FILE.json $FILE.tar.gz |
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