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
This commit is contained in:
77
aula-13/images/devops-toolbox/.gitlab-ci.yml
Normal file
77
aula-13/images/devops-toolbox/.gitlab-ci.yml
Normal file
@@ -0,0 +1,77 @@
|
||||
# =============================================================================
|
||||
# Pipeline CI: DevOps Toolbox (eStargz + GZIP)
|
||||
# =============================================================================
|
||||
# Constrói imagem em ambos os formatos para benchmark
|
||||
# =============================================================================
|
||||
|
||||
stages:
|
||||
- build
|
||||
- push
|
||||
|
||||
variables:
|
||||
REGISTRY: registry.kube.quest
|
||||
IMAGE_NAME: factory/devops-toolbox
|
||||
DOCKER_HOST: tcp://docker:2376
|
||||
DOCKER_TLS_CERTDIR: "/certs"
|
||||
DOCKER_TLS_VERIFY: 1
|
||||
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build eStargz (lazy pulling)
|
||||
# -----------------------------------------------------------------------------
|
||||
build-estargz:
|
||||
stage: build
|
||||
image: docker:27-dind
|
||||
services:
|
||||
- docker:27-dind
|
||||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $REGISTRY
|
||||
- docker buildx create --use --name multiarch --driver docker-container
|
||||
script:
|
||||
- |
|
||||
docker buildx build \
|
||||
--platform linux/arm64,linux/amd64 \
|
||||
--output type=image,name=${REGISTRY}/${IMAGE_NAME}:latest,push=true,compression=estargz,force-compression=true,oci-mediatypes=true \
|
||||
--cache-from type=registry,ref=${REGISTRY}/${IMAGE_NAME}:cache \
|
||||
--cache-to type=registry,ref=${REGISTRY}/${IMAGE_NAME}:cache,mode=max \
|
||||
.
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build GZIP (tradicional, para benchmark)
|
||||
# -----------------------------------------------------------------------------
|
||||
build-gzip:
|
||||
stage: build
|
||||
image: docker:27-dind
|
||||
services:
|
||||
- docker:27-dind
|
||||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $REGISTRY
|
||||
- docker buildx create --use --name multiarch --driver docker-container
|
||||
script:
|
||||
- |
|
||||
docker buildx build \
|
||||
--platform linux/arm64,linux/amd64 \
|
||||
--output type=image,name=${REGISTRY}/${IMAGE_NAME}:gzip,push=true,compression=gzip,oci-mediatypes=true \
|
||||
--cache-from type=registry,ref=${REGISTRY}/${IMAGE_NAME}:cache \
|
||||
.
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Tag como versão
|
||||
# -----------------------------------------------------------------------------
|
||||
push-tags:
|
||||
stage: push
|
||||
image: docker:27-cli
|
||||
services:
|
||||
- docker:27-dind
|
||||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $REGISTRY
|
||||
script:
|
||||
- docker buildx imagetools create -t ${REGISTRY}/${IMAGE_NAME}:v1 ${REGISTRY}/${IMAGE_NAME}:latest
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
needs:
|
||||
- build-estargz
|
||||
90
aula-13/images/devops-toolbox/Dockerfile
Normal file
90
aula-13/images/devops-toolbox/Dockerfile
Normal file
@@ -0,0 +1,90 @@
|
||||
# =============================================================================
|
||||
# DevOps Toolbox - Demonstração de eStargz
|
||||
# =============================================================================
|
||||
# Imagem grande (~650MB) com múltiplas ferramentas em camadas separadas.
|
||||
# Ideal para demonstrar lazy pulling: você só usa UMA ferramenta por vez!
|
||||
# =============================================================================
|
||||
|
||||
FROM alpine:3.21
|
||||
|
||||
LABEL maintainer="workshop"
|
||||
LABEL description="DevOps toolbox for eStargz lazy pulling demonstration"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Camada 1: Ferramentas básicas (~50MB)
|
||||
# -----------------------------------------------------------------------------
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
curl \
|
||||
wget \
|
||||
jq \
|
||||
git \
|
||||
openssh-client \
|
||||
ca-certificates \
|
||||
unzip
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Camada 2: Terraform (~100MB)
|
||||
# -----------------------------------------------------------------------------
|
||||
ARG TERRAFORM_VERSION=1.9.8
|
||||
ARG TARGETARCH
|
||||
RUN wget -q "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${TARGETARCH}.zip" -O /tmp/terraform.zip && \
|
||||
unzip -q /tmp/terraform.zip -d /usr/local/bin/ && \
|
||||
rm /tmp/terraform.zip && \
|
||||
chmod +x /usr/local/bin/terraform
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Camada 3: OpenTofu (~100MB)
|
||||
# -----------------------------------------------------------------------------
|
||||
ARG TOFU_VERSION=1.8.8
|
||||
RUN wget -q "https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_linux_${TARGETARCH}.zip" -O /tmp/tofu.zip && \
|
||||
unzip -q /tmp/tofu.zip -d /usr/local/bin/ && \
|
||||
rm /tmp/tofu.zip && \
|
||||
chmod +x /usr/local/bin/tofu
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Camada 4: Kubectl (~50MB)
|
||||
# -----------------------------------------------------------------------------
|
||||
ARG KUBECTL_VERSION=1.31.4
|
||||
RUN curl -sLO "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl" && \
|
||||
chmod +x kubectl && \
|
||||
mv kubectl /usr/local/bin/
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Camada 5: Helm (~50MB)
|
||||
# -----------------------------------------------------------------------------
|
||||
ARG HELM_VERSION=3.16.4
|
||||
RUN wget -q "https://get.helm.sh/helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz" -O /tmp/helm.tar.gz && \
|
||||
tar -xzf /tmp/helm.tar.gz -C /tmp && \
|
||||
mv /tmp/linux-${TARGETARCH}/helm /usr/local/bin/ && \
|
||||
rm -rf /tmp/helm.tar.gz /tmp/linux-${TARGETARCH}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Camada 6: AWS CLI (~200MB)
|
||||
# -----------------------------------------------------------------------------
|
||||
RUN apk add --no-cache aws-cli
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Camada 7: Python + Ansible (~150MB)
|
||||
# -----------------------------------------------------------------------------
|
||||
RUN apk add --no-cache python3 py3-pip && \
|
||||
pip3 install --no-cache-dir ansible --break-system-packages --quiet
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Camada 8: k9s (~50MB)
|
||||
# -----------------------------------------------------------------------------
|
||||
ARG K9S_VERSION=0.32.7
|
||||
RUN wget -q "https://github.com/derailed/k9s/releases/download/v${K9S_VERSION}/k9s_Linux_${TARGETARCH}.tar.gz" -O /tmp/k9s.tar.gz && \
|
||||
tar -xzf /tmp/k9s.tar.gz -C /usr/local/bin/ k9s && \
|
||||
rm /tmp/k9s.tar.gz
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Entrypoint
|
||||
# -----------------------------------------------------------------------------
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["--help"]
|
||||
64
aula-13/images/devops-toolbox/entrypoint.sh
Normal file
64
aula-13/images/devops-toolbox/entrypoint.sh
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
# =============================================================================
|
||||
# DevOps Toolbox Entrypoint
|
||||
# =============================================================================
|
||||
# Executa a ferramenta especificada ou mostra ajuda
|
||||
# =============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
# Ferramentas disponíveis
|
||||
TOOLS="terraform tofu kubectl helm aws ansible k9s"
|
||||
|
||||
show_help() {
|
||||
echo "DevOps Toolbox - Demonstração de eStargz Lazy Pulling"
|
||||
echo ""
|
||||
echo "Uso: docker run toolbox <ferramenta> [argumentos]"
|
||||
echo ""
|
||||
echo "Ferramentas disponíveis:"
|
||||
echo " terraform - Infrastructure as Code"
|
||||
echo " tofu - OpenTofu (Terraform fork)"
|
||||
echo " kubectl - Kubernetes CLI"
|
||||
echo " helm - Kubernetes package manager"
|
||||
echo " aws - AWS CLI"
|
||||
echo " ansible - Configuration management"
|
||||
echo " k9s - Kubernetes TUI"
|
||||
echo ""
|
||||
echo "Exemplos:"
|
||||
echo " docker run toolbox terraform version"
|
||||
echo " docker run toolbox kubectl version --client"
|
||||
echo " docker run toolbox helm version"
|
||||
echo ""
|
||||
echo "Com eStargz, apenas a camada da ferramenta usada é baixada!"
|
||||
}
|
||||
|
||||
show_versions() {
|
||||
echo "Versões instaladas:"
|
||||
echo ""
|
||||
terraform version 2>/dev/null | head -1 || echo "terraform: não disponível"
|
||||
tofu version 2>/dev/null | head -1 || echo "tofu: não disponível"
|
||||
kubectl version --client 2>/dev/null | head -1 || echo "kubectl: não disponível"
|
||||
helm version --short 2>/dev/null || echo "helm: não disponível"
|
||||
aws --version 2>/dev/null || echo "aws: não disponível"
|
||||
ansible --version 2>/dev/null | head -1 || echo "ansible: não disponível"
|
||||
k9s version --short 2>/dev/null || echo "k9s: não disponível"
|
||||
}
|
||||
|
||||
# Processa argumentos
|
||||
case "$1" in
|
||||
--help|-h|"")
|
||||
show_help
|
||||
;;
|
||||
--versions|-v)
|
||||
show_versions
|
||||
;;
|
||||
terraform|tofu|kubectl|helm|aws|ansible|k9s)
|
||||
exec "$@"
|
||||
;;
|
||||
*)
|
||||
echo "Erro: Ferramenta '$1' não reconhecida"
|
||||
echo ""
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user