Skip to content
Snippets Groups Projects
Verified Commit cc264390 authored by Lucas Briese's avatar Lucas Briese
Browse files

ci: tweak deploy.sh

parent de6a67b9
No related branches found
No related tags found
No related merge requests found
......@@ -47,9 +47,11 @@
else
# need to be manually saved
# live object contains keys which can't be "applied"
liveObject=$("${kctl[@]}" get -f "$file" -o json)
rmKeys='del(.metadata.creationTimestamp, .metadata.managedFields, .metadata.resourceVersion, .metadata.uid, .metadata.selfLink, .metadata.annotations)'
echo "$liveObject" | jq "$rmKeys" > "$backup/${file:2}"
if "${kctl[@]}" get -f "$file"; then # if objects exists in the cluster
liveObject=$("${kctl[@]}" get -f "$file" -o json)
rmKeys='del(.metadata.creationTimestamp, .metadata.managedFields, .metadata.resourceVersion, .metadata.uid, .metadata.selfLink, .metadata.annotations)'
echo "$liveObject" | jq "$rmKeys" > "$backup/${file:2}"
fi
fi
done
}
......@@ -64,11 +66,15 @@
updateImage
# finally deploy
"${kctl[@]}" apply -f .
"${kctl[@]}" annotate -f . kubernetes.io/change-cause="$reason" --overwrite=true
if ! "${kctl[@]}" rollout status -f ./deployment.yaml --watch=true --timeout 300s; then
echo "[warning][deploy.sh] deploy failed"
"$rollback" "$target" "$backup"
exit 1
if "${kctl[@]}" apply -f .; then
"${kctl[@]}" annotate -f . kubernetes.io/change-cause="$reason" --overwrite=true
if ! "${kctl[@]}" rollout status -f ./deployment.yaml --watch=true --timeout 300s; then
echo "[warning][deploy.sh] deploy failed"
"$rollback" "$target" "$backup"
exit 1
fi
else
echo "critical error during deploy, you need to manually revert changes!"
exit 2
fi
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.