From 658f13d00e73f10bc5daec9e3f48671a64457bc5 Mon Sep 17 00:00:00 2001 From: devops Date: Thu, 25 Jun 2026 05:11:33 +0000 Subject: [PATCH] =?UTF-8?q?A=C3=B1adir=20workloads/ecommerce/azure-pipelin?= =?UTF-8?q?es.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workloads/ecommerce/azure-pipelines.yml | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 workloads/ecommerce/azure-pipelines.yml diff --git a/workloads/ecommerce/azure-pipelines.yml b/workloads/ecommerce/azure-pipelines.yml new file mode 100644 index 0000000..78af688 --- /dev/null +++ b/workloads/ecommerce/azure-pipelines.yml @@ -0,0 +1,39 @@ +trigger: + - main + +pool: + vmImage: 'ubuntu-latest' +https://gitea.cruzcloud.net/devops/apps-registry/src/branch/main/workloads/ecommerce +variables: + # Cambia esto por tu usuario de Gitea + registryName: 'gitea.cruzcloud.net' + imageName: 'devops/ecommerce-frontend' + tag: '$(Build.BuildId)' + +steps: +# 1. Construcción de Imagen Docker +- task: Docker@2 + displayName: 'Construir y Subir Imagen a Gitea' + inputs: + containerRegistry: 'gitea-registry-connection' # Nombre de la conexión que creamos en Azure DevOps + repository: '$(imageName)' + command: 'buildAndPush' + Dockerfile: '**/Dockerfile' + tags: | + $(tag) + latest + +# 2. Actualización GitOps (Notificar a Argo CD) +# Esto clona tu repo de despliegue, cambia la imagen y hace commit +- script: | + git clone https://$(gitea_token)@gitea.cruzcloud.net/devops/apps-registry.git + cd apps-registry/workloads/ecommerce + sed -i "s|image: .*|image: $(registryName)/$(imageName):$(tag)|g" frontend.yaml + git config user.email "cristiancruz0529@gmail.com" + git config user.name "Cristian" + git add frontend.yaml + git commit -m "Auto-update image tag to $(tag)" + git push origin main + displayName: 'Actualizar GitOps Repo' + env: + gitea_token: $(GITEA_TOKEN) # Token generado en Gitea configurado como variable secreta \ No newline at end of file