Files
workshop/aula-11/node-bugado/.gitea/workflows/ci.yml
ArgoCD Setup d380cd8585 refactor: migrar GitLab → Gitea (aulas 10, 11, 13)
- Aula 10: Gitea + Registry + Actions + Runner (substituiu GitLab)
  - gitea-values.yaml: PostgreSQL standalone, Valkey standalone, ~800Mi RAM
  - setup.sh/cleanup.sh: namespace gitea, Helm gitea-charts/gitea + actions
  - README.md: documentação completa com de→para (GitLab/Harbor/Tekton vs Gitea)

- Aula 11: ArgoCD (GitOps) — removido GitLab Runner (runner vive na aula-10)
  - setup.sh: só ArgoCD, integração SSH com Gitea
  - node-bugado/.gitea/workflows/ci.yml: pipeline convertida

- Aula 13: Container Factory — atualizado para Gitea
  - setup.sh/cleanup.sh: referências GitLab → Gitea
  - pipelines/postgresql/ci.yml: Gitea Actions workflow
  - README.md: conexão com act_runner explicada

- CLAUDE.md: tabela de aulas atualizada
2026-03-14 01:44:30 -03:00

78 lines
2.7 KiB
YAML

# =============================================================================
# Gitea Actions Workflow - node-bugado
# =============================================================================
#
# Pipeline GitOps:
# 1. Build: Constrói imagem Docker e faz push para Gitea Registry
# 2. Deploy: Atualiza manifests no repo GitOps (ArgoCD faz sync)
#
# Secrets necessários (Repository → Settings → Actions → Secrets):
# - REGISTRY_TOKEN: Token para push no Gitea Container Registry
# - DEPLOY_KEY: Chave SSH privada para push no repo GitOps
# - GITOPS_REPO: URL SSH do repo GitOps (ex: git@gitea.kube.quest:user/gitops-demo.git)
#
# =============================================================================
name: Build and Deploy
on:
push:
branches: [main]
env:
REGISTRY: gitea.kube.quest
IMAGE_NAME: ${{ gitea.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Gitea Registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ env.REGISTRY }} \
-u ${{ gitea.actor }} --password-stdin
- name: Build and push
run: |
echo "Building ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
docker build \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
.
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan gitea.kube.quest >> ~/.ssh/known_hosts 2>/dev/null || true
- name: Update GitOps repo
run: |
git config --global user.email "ci@gitea.kube.quest"
git config --global user.name "Gitea CI"
git clone ${{ secrets.GITOPS_REPO }} gitops
cd gitops
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-8)
if [ -f apps/node-bugado/deployment.yaml ]; then
sed -i "s|image:.*node-bugado.*|image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}|g" apps/node-bugado/deployment.yaml
git add apps/node-bugado/deployment.yaml
git commit -m "deploy: node-bugado ${SHORT_SHA} [skip ci]"
git push
echo "GitOps repo updated"
else
echo "WARNING: apps/node-bugado/deployment.yaml not found"
exit 1
fi