From fa40b2882466a06a0ef6b76c712eab6de18c7a69 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Sat, 18 Apr 2026 16:48:24 -0300 Subject: [PATCH] =?UTF-8?q?Fix:=20Corrige=20l=C3=B3gica=20de=20setup=20do?= =?UTF-8?q?=20reposit=C3=B3rio=20(v5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adiciona verificação se repositório existe antes de pull - Se não existir, inicializa com git init + fetch (clone alternativo) - Adiciona verificação de Cargo.toml antes do build - Mantém compatibilidade com estrutura existente no runner - Hash buster para v5 força reavaliação do workflow --- .forgejo/workflows/botserver-v2.yaml | 47 +++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/botserver-v2.yaml b/.forgejo/workflows/botserver-v2.yaml index 1cc61c4a..f22a5fd0 100644 --- a/.forgejo/workflows/botserver-v2.yaml +++ b/.forgejo/workflows/botserver-v2.yaml @@ -1,5 +1,5 @@ -# HASH-BUSTER-20260418-UNIQUE-ID-v4 -# NOVO WORKFLOW - Forçar refresh do cache (v4 - corrige caminho do build) +# HASH-BUSTER-20260418-UNIQUE-ID-v5 +# NOVO WORKFLOW - Forçar refresh do cache (v5 - corrige lógica de submodules) name: BotServer CI/CD v2 on: @@ -24,16 +24,49 @@ jobs: pkill -9 sccache || true echo "Setup concluído." - - name: Pull Sources + - name: Setup Repository Structure run: | - echo "=== Atualizando Código ===" - cd /opt/gbo/work/botserver - git pull origin main - echo "Código atualizado." + echo "=== Configurando Estrutura do Repositório ===" + + # Criar diretório base se não existir + mkdir -p /opt/gbo/work/botserver + + # Verificar se já é um repositório git + if [ ! -d /opt/gbo/work/botserver/.git ]; then + echo "Repositório não existe, clonando..." + cd /opt/gbo/work/botserver + git init + git remote add origin https://alm.pragmatismo.com.br/GeneralBots/BotServer.git + git fetch --depth 1 origin main + git reset --hard origin/main + else + echo "Repositório já existe, atualizando..." + cd /opt/gbo/work/botserver + git pull origin main + fi + + # Atualizar botlib se existir como submodule/pasta + if [ -d /opt/gbo/work/botserver/botlib ]; then + echo "Atualizando botlib..." + cd /opt/gbo/work/botserver/botlib + git pull origin main + cd .. + fi + + echo "Estrutura configurada." - name: Build Debug run: | echo "=== Compilando (Debug) ===" cd /opt/gbo/work/botserver + + # Verificar se Cargo.toml existe + if [ ! -f Cargo.toml ]; then + echo "ERRO: Cargo.toml não encontrado em $(pwd)" + ls -la + exit 1 + fi + + echo "Cargo.toml encontrado em $(pwd)/Cargo.toml" cargo build echo "Build finalizado."