Compare commits
16 Commits
fix/cd-wor
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a6852acbb | |||
| 037a3f4d93 | |||
| 18c22e85c4 | |||
| 154d498699 | |||
| 1352edf289 | |||
| 0bae06d411 | |||
| 23828ee5ef | |||
| f72f0fec94 | |||
| 736cc0f277 | |||
| f61b1a05e5 | |||
| 9a6c43edfc | |||
| 4ea625f95c | |||
| e0e5585d7c | |||
| 4de6055040 | |||
| 9aa860a6e5 | |||
| c987d3e33f |
@ -14,6 +14,18 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Instala kubectl + auth plugin (gcloud já vem via setup-gcloud).
|
||||||
|
# Build é feito remoto via Cloud Build (não precisa Docker no runner).
|
||||||
|
- name: Install kubectl + gke-auth-plugin
|
||||||
|
run: |
|
||||||
|
apt-get update -qq
|
||||||
|
apt-get install -y -qq apt-transport-https ca-certificates gnupg curl
|
||||||
|
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||||
|
apt-get update -qq
|
||||||
|
apt-get install -y -qq kubectl google-cloud-cli-gke-gcloud-auth-plugin
|
||||||
|
kubectl version --client=true
|
||||||
|
|
||||||
- name: Auth GCP
|
- name: Auth GCP
|
||||||
uses: google-github-actions/auth@v2
|
uses: google-github-actions/auth@v2
|
||||||
with:
|
with:
|
||||||
@ -24,21 +36,48 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
project_id: ${{ secrets.GCP_PROJECT }}
|
project_id: ${{ secrets.GCP_PROJECT }}
|
||||||
|
|
||||||
- name: Configure Docker auth
|
- name: Build & push (Cloud Build, sem Docker local)
|
||||||
run: gcloud auth configure-docker ${{ secrets.AR_LOCATION }}-docker.pkg.dev --quiet
|
|
||||||
|
|
||||||
- name: Build image
|
|
||||||
run: |
|
run: |
|
||||||
|
set -e
|
||||||
IMG="${IMAGE_BASE}/${{ gitea.event.repository.name }}:lab-${{ gitea.run_number }}"
|
IMG="${IMAGE_BASE}/${{ gitea.event.repository.name }}:lab-${{ gitea.run_number }}"
|
||||||
docker build --platform=linux/amd64 -t "$IMG" .
|
# --gcs-source-staging-dir: pula o auto-detect que precisa de
|
||||||
|
# storage.buckets.list (project-scope). gitea-cd só tem grant
|
||||||
|
# na bucket _cloudbuild, não no projeto inteiro.
|
||||||
|
# --async: gcloud retorna assim que o build é enfileirado. Sem
|
||||||
|
# isso, gcloud tenta streamar Cloud Logging, exige Viewer/Owner
|
||||||
|
# no projeto, e --suppress-logs nessa versão do CLI ainda dá
|
||||||
|
# exit != 0 quando não consegue ler. Polling abaixo é o trade.
|
||||||
|
BUILD_ID=$(gcloud builds submit \
|
||||||
|
--tag "$IMG" \
|
||||||
|
--project=${{ secrets.GCP_PROJECT }} \
|
||||||
|
--timeout=30m \
|
||||||
|
--gcs-source-staging-dir="gs://${{ secrets.GCP_PROJECT }}_cloudbuild/source" \
|
||||||
|
--async \
|
||||||
|
--format="value(id)")
|
||||||
|
echo "Cloud Build kicked off: $BUILD_ID"
|
||||||
|
# Poll até terminar. gcloud builds describe usa cloudbuild.builds.get
|
||||||
|
# (já incluído em roles/cloudbuild.builds.editor).
|
||||||
|
while true; do
|
||||||
|
STATUS=$(gcloud builds describe "$BUILD_ID" \
|
||||||
|
--project=${{ secrets.GCP_PROJECT }} \
|
||||||
|
--region=global \
|
||||||
|
--format="value(status)")
|
||||||
|
echo "[$(date -u +%H:%M:%S)] build $BUILD_ID: $STATUS"
|
||||||
|
case "$STATUS" in
|
||||||
|
SUCCESS) break ;;
|
||||||
|
FAILURE|INTERNAL_ERROR|TIMEOUT|CANCELLED|EXPIRED)
|
||||||
|
echo "::error::Cloud Build $STATUS — ver console: https://console.cloud.google.com/cloud-build/builds/$BUILD_ID?project=${{ secrets.GCP_PROJECT }}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
sleep 15
|
||||||
|
done
|
||||||
echo "IMG=$IMG" >> $GITHUB_ENV
|
echo "IMG=$IMG" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Push image (apenas em push pra master/main)
|
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: docker push "$IMG"
|
|
||||||
|
|
||||||
- name: Deploy hml2 (apenas em push pra master/main)
|
- name: Deploy hml2 (apenas em push pra master/main)
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
|
env:
|
||||||
|
USE_GKE_GCLOUD_AUTH_PLUGIN: "True"
|
||||||
run: |
|
run: |
|
||||||
gcloud container clusters get-credentials ${{ secrets.GKE_CLUSTER }} --region ${{ secrets.GKE_REGION }} --project ${{ secrets.GCP_PROJECT }}
|
gcloud container clusters get-credentials ${{ secrets.GKE_CLUSTER }} --region ${{ secrets.GKE_REGION }} --project ${{ secrets.GCP_PROJECT }}
|
||||||
NS=${{ secrets.K8S_NAMESPACE }}
|
NS=${{ secrets.K8S_NAMESPACE }}
|
||||||
@ -53,7 +92,7 @@ jobs:
|
|||||||
if kubectl get deployment "$DEPLOYMENT" -n "$NS" >/dev/null 2>&1; then
|
if kubectl get deployment "$DEPLOYMENT" -n "$NS" >/dev/null 2>&1; then
|
||||||
CONTAINER=$(kubectl get deployment "$DEPLOYMENT" -n "$NS" -o jsonpath='{.spec.template.spec.containers[0].name}')
|
CONTAINER=$(kubectl get deployment "$DEPLOYMENT" -n "$NS" -o jsonpath='{.spec.template.spec.containers[0].name}')
|
||||||
kubectl set image deployment/"$DEPLOYMENT" -n "$NS" "$CONTAINER=$IMG"
|
kubectl set image deployment/"$DEPLOYMENT" -n "$NS" "$CONTAINER=$IMG"
|
||||||
kubectl rollout status deployment/"$DEPLOYMENT" -n "$NS" --timeout=300s
|
kubectl rollout status deployment/"$DEPLOYMENT" -n "$NS" --timeout=600s
|
||||||
else
|
else
|
||||||
echo "Deployment $DEPLOYMENT não existe no ns $NS — pulei set image (provavelmente é o 1º deploy e o kubectl apply acabou de criar)"
|
echo "Deployment $DEPLOYMENT não existe no ns $NS — pulei set image (provavelmente é o 1º deploy e o kubectl apply acabou de criar)"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -7,7 +7,7 @@ ARG VANNA_UPSTREAM_COMMIT=365d0617c1a4567ffee1b19b40c27feb4206bfcf
|
|||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Stage 1 — webcomponent (Node)
|
# Stage 1 — webcomponent (Node)
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
FROM node:18-bookworm-slim AS webcomponent
|
FROM node:20-bookworm-slim AS webcomponent
|
||||||
ARG VANNA_UPSTREAM_COMMIT
|
ARG VANNA_UPSTREAM_COMMIT
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
|
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|||||||
2
agent.py
2
agent.py
@ -154,7 +154,7 @@ def build_agent(
|
|||||||
temperature = float(os.environ.get("OPENAI_TEMPERATURE", "1.0"))
|
temperature = float(os.environ.get("OPENAI_TEMPERATURE", "1.0"))
|
||||||
|
|
||||||
welcome_message = (
|
welcome_message = (
|
||||||
"#### 👋 Olá! Aqui é a ClubPetro IA\n\n"
|
"**👋 Olá! Aqui é a ClubPetro IA**\n\n"
|
||||||
"Sua assistente de inteligência de dados. Eu transformo dados complexos em "
|
"Sua assistente de inteligência de dados. Eu transformo dados complexos em "
|
||||||
"respostas claras, direto ao ponto. Precisa de um relatório de faturamento, "
|
"respostas claras, direto ao ponto. Precisa de um relatório de faturamento, "
|
||||||
"entender a performance da sua equipe ou aprofundar no comportamento de "
|
"entender a performance da sua equipe ou aprofundar no comportamento de "
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user