This commit is contained in:
samsep101
2026-01-05 16:35:15 +05:00
parent 8b7b90f0c2
commit 30a3bcc955

View File

@@ -34,20 +34,25 @@ jobs:
--label "org.label-schema.vcs-ref=${{ steps.vars.outputs.sha_full }}"
--label "org.label-schema.build-date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Update infrastructure with Kustomize
- name: Update infrastructure repository
run: |
# Клонируем инфра-репозиторий
git clone https://${{ secrets.USER }}:${{ secrets.GITEA }}@gitea.apps.kopikopi.com.ru/examples/nginx-intrasture.git
cd nginx-intrasture/apps/static-site
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O yq
chmod +x yq
# Обновляем ТЕГ образа в deployment.yaml (не только в kustomization.yaml)
./yq eval -i '.spec.template.spec.containers[0].image = "harbor.apps.kopikopi.com.ru/drone/test:'${{ steps.vars.outputs.sha_short }}'"' deployment.yaml
# Коммитим и пушим
# Простое решение: используем sed для изменения deployment.yaml
NEW_IMAGE="harbor.apps.kopikopi.com.ru/drone/test:${{ steps.vars.outputs.sha_short }}"
# Обновляем deployment.yaml
sed -i "s|image:.*drone/test:.*|image: $NEW_IMAGE|g" deployment.yaml
# Проверяем изменение
echo "Updated deployment.yaml:"
grep image deployment.yaml
# Коммитим изменения
git config user.name "CI/CD Bot"
git config user.email "ci-cd@kopikopi.com.ru"
git add kustomization.yaml
git add deployment.yaml
git commit -m "Update image to ${{ steps.vars.outputs.sha_short }}"
git push