add healthcheck to bursatil

This commit is contained in:
2025-11-25 06:15:24 +00:00
parent cccf0a4784
commit eccd53673c
2 changed files with 236 additions and 41 deletions

View File

@@ -19,65 +19,255 @@ jobs:
detect-changes: detect-changes:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
changed-apps: ${{ steps.detect.outputs.changed-apps }} bursatil: ${{ steps.filter.outputs.bursatil }}
ChatEgresos: ${{ steps.filter.outputs.ChatEgresos }}
inversionistas: ${{ steps.filter.outputs.inversionistas }}
normativa: ${{ steps.filter.outputs.normativa }}
ocp: ${{ steps.filter.outputs.ocp }}
pyme: ${{ steps.filter.outputs.pyme }}
riesgos: ${{ steps.filter.outputs.riesgos }}
Test: ${{ steps.filter.outputs.Test }}
voz-del-cliente: ${{ steps.filter.outputs.voz-del-cliente }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect changed apps - name: Detect changed apps
id: detect uses: dorny/paths-filter@v3
run: | id: filter
# Get list of changed apps compared to previous commit with:
if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then base: main
# Initial push - build all apps filters: |
CHANGED_APPS=$(ls -d apps/*/ | sed 's|apps/||g' | sed 's|/||g' | jq -R -s -c 'split("\n")[:-1]') bursatil:
else - 'apps/bursatil/**'
# Compare with previous commit ChatEgresos:
CHANGED_APPS=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '^apps/' | cut -d/ -f2 | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))') - 'apps/ChatEgresos/**'
fi inversionistas:
- 'apps/inversionistas/**'
normativa:
- 'apps/normativa/**'
ocp:
- 'apps/ocp/**'
pyme:
- 'apps/pyme/**'
riesgos:
- 'apps/riesgos/**'
Test:
- 'apps/Test/**'
voz-del-cliente:
- 'apps/voz-del-cliente/**'
echo "changed-apps=$CHANGED_APPS" >> $GITHUB_OUTPUT build-bursatil:
echo "Changed apps: $CHANGED_APPS"
build-and-push:
needs: detect-changes needs: detect-changes
if: needs.detect-changes.outputs.changed-apps != '[]' if: needs.detect-changes.outputs.bursatil == 'true'
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
app: ${{ fromJson(needs.detect-changes.outputs.changed-apps) }}
fail-fast: false
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Log in to Gitea Registry - name: Log in to Gitea Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ secrets.GITEA_REGISTRY_USERNAME }} username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.GITEA_REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Extract metadata
id: meta
run: |
IMAGE="${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-${{ matrix.app }}"
echo "image=$IMAGE" >> $GITHUB_OUTPUT
echo "tags=$IMAGE:latest,$IMAGE:${{ github.sha }}" >> $GITHUB_OUTPUT
- name: Build and push - name: Build and push
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
file: .containers/python/Dockerfile file: .containers/python/Dockerfile
push: true push: true
tags: ${{ steps.meta.outputs.image }}:latest,${{ steps.meta.outputs.image }}:${{ github.sha }} tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-bursatil:latest
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-bursatil:${{ github.sha }}
build-args: | build-args: |
PACKAGE=${{ matrix.app }} PACKAGE=bursatil
- name: Image summary build-ChatEgresos:
run: | needs: detect-changes
echo "### ✅ Built and pushed: ${{ matrix.app }}" >> $GITHUB_STEP_SUMMARY if: needs.detect-changes.outputs.ChatEgresos == 'true'
echo "" >> $GITHUB_STEP_SUMMARY runs-on: ubuntu-latest
echo "Image: ${{ steps.meta.outputs.image }}" >> $GITHUB_STEP_SUMMARY steps:
echo "Tags: latest, ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY - uses: actions/checkout@v4
- name: Log in to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: .containers/python/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-ChatEgresos:latest
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-ChatEgresos:${{ github.sha }}
build-args: |
PACKAGE=ChatEgresos
build-inversionistas:
needs: detect-changes
if: needs.detect-changes.outputs.inversionistas == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: .containers/python/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-inversionistas:latest
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-inversionistas:${{ github.sha }}
build-args: |
PACKAGE=inversionistas
build-normativa:
needs: detect-changes
if: needs.detect-changes.outputs.normativa == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: .containers/python/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-normativa:latest
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-normativa:${{ github.sha }}
build-args: |
PACKAGE=normativa
build-ocp:
needs: detect-changes
if: needs.detect-changes.outputs.ocp == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: .containers/python/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-ocp:latest
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-ocp:${{ github.sha }}
build-args: |
PACKAGE=ocp
build-pyme:
needs: detect-changes
if: needs.detect-changes.outputs.pyme == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: .containers/python/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-pyme:latest
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-pyme:${{ github.sha }}
build-args: |
PACKAGE=pyme
build-riesgos:
needs: detect-changes
if: needs.detect-changes.outputs.riesgos == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: .containers/python/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-riesgos:latest
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-riesgos:${{ github.sha }}
build-args: |
PACKAGE=riesgos
build-Test:
needs: detect-changes
if: needs.detect-changes.outputs.Test == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: .containers/python/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-Test:latest
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-Test:${{ github.sha }}
build-args: |
PACKAGE=Test
build-voz-del-cliente:
needs: detect-changes
if: needs.detect-changes.outputs.voz-del-cliente == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: .containers/python/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-voz-del-cliente:latest
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}-voz-del-cliente:${{ github.sha }}
build-args: |
PACKAGE=voz-del-cliente

View File

@@ -53,3 +53,8 @@ async def send(message: Message, stream: bool = False):
agent, message.prompt, message.conversation_id agent, message.prompt, message.conversation_id
) )
return response return response
@app.get("/")
async def health():
return {"status": "ok"}