fix(ci): deploy-gitops env branch

This commit is contained in:
sova-ci
2026-06-02 19:11:30 +03:00
parent 8d1ae78923
commit 7a73bb080f
+9 -4
View File
@@ -85,10 +85,15 @@ jobs:
DEPLOY_USER: ${{ secrets.REGISTRY_USER }}
run: |
REPO_URL="http://${DEPLOY_USER}:${DEPLOY_TOKEN}@gitea-http.gitea.svc.cluster.local:3000/sova/sova-deploy.git"
git clone "${REPO_URL}"
cd sova-deploy
ENV="${{ needs.parse-tag.outputs.env }}"
TAG="${{ needs.parse-tag.outputs.full_tag }}"
case "${ENV}" in
test|stage|prod) ;;
*) echo "Unknown env from tag: ${ENV}"; exit 1 ;;
esac
git clone --branch "${ENV}" --single-branch "${REPO_URL}" sova-deploy 2>/dev/null \
|| { git clone "${REPO_URL}" sova-deploy && cd sova-deploy && git checkout -B "${ENV}"; }
cd sova-deploy
git config user.email "ci-bot@sova.local"
git config user.name "sova-ci"
MAX_RETRIES=5
@@ -100,14 +105,14 @@ jobs:
curl -sSL -o /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_${YQ_ARCH}"
chmod +x /usr/local/bin/yq
for attempt in $(seq 1 $MAX_RETRIES); do
git pull --rebase "${REPO_URL}" main
git pull --rebase origin "${ENV}"
yq -i ".image.repository = \"${IMAGE_DEPLOY}\"" "apps/docs/values-${ENV}.yaml"
yq -i ".image.tag = \"${TAG}\"" "apps/docs/values-${ENV}.yaml"
yq -i ".image.pullPolicy = \"IfNotPresent\"" "apps/docs/values-${ENV}.yaml"
git add "apps/docs/values-${ENV}.yaml"
git diff --cached --quiet && { echo "No changes"; exit 0; }
git commit -m "chore(docs): bump ${ENV} to ${TAG}"
if git push "${REPO_URL}" main; then
if git push origin "${ENV}"; then
echo "Push OK on attempt ${attempt}"
exit 0
fi