fix: correct pipeline to update k8s manifest
All checks were successful
Build (develop) / Promote (main) / build-and-push-deploy (push) Successful in 1m21s
All checks were successful
Build (develop) / Promote (main) / build-and-push-deploy (push) Successful in 1m21s
This commit is contained in:
@@ -24,20 +24,16 @@ jobs:
|
|||||||
docker push "$IMAGE_NAME:$SHA_TAG"
|
docker push "$IMAGE_NAME:$SHA_TAG"
|
||||||
docker push "$IMAGE_NAME:latest"
|
docker push "$IMAGE_NAME:latest"
|
||||||
|
|
||||||
- name: Update Manifest and Push to Git
|
- name: Update Kubernetes Manifest
|
||||||
run: |
|
run: |
|
||||||
SHA_TAG=$(echo ${{ gitea.sha }} | cut -c1-7)
|
SHA_TAG=$(echo ${{ gitea.sha }} | cut -c1-7)
|
||||||
IMAGE_NAME="git.simplifiquehc.com.br/simplifique/vendaweb-api"
|
IMAGE_NAME="git.simplifiquehc.com.br/simplifique/vendaweb-api"
|
||||||
|
|
||||||
# 1. Altera a imagem no arquivo YAML (ajuste o caminho 'deploy-api.yaml' se necessário)
|
sed -i "s|image: $IMAGE_NAME:.*|image: $IMAGE_NAME:$SHA_TAG|g" k8s/base/deployment.yaml
|
||||||
# O comando procura a linha 'image:' e substitui pela nova tag do SHA
|
|
||||||
sed -i "s|image: $IMAGE_NAME:.*|image: $IMAGE_NAME:$SHA_TAG|g" deploy-api.yaml
|
|
||||||
|
|
||||||
# 2. Configura o Git para commitar a alteração
|
|
||||||
git config --global user.name "Gitea Action"
|
git config --global user.name "Gitea Action"
|
||||||
git config --global user.email "actions@simplifiquehc.com.br"
|
git config --global user.email "actions@simplifiquehc.com.br"
|
||||||
|
|
||||||
# 3. Faz o commit e push da alteração no manifesto
|
git add k8s/base/deployment.yaml
|
||||||
git add deploy-api.yaml
|
|
||||||
git commit -m "chore: update image tag to $SHA_TAG [skip ci]"
|
git commit -m "chore: update image tag to $SHA_TAG [skip ci]"
|
||||||
git push origin main
|
git push origin main
|
||||||
|
|||||||
Reference in New Issue
Block a user