diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index 51a19f5..233a59d 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -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 \ No newline at end of file