forked from innovacion/Mayacontigo
add healthcheck to bursatil
This commit is contained in:
272
.github/workflows/release.yml
vendored
272
.github/workflows/release.yml
vendored
@@ -19,65 +19,255 @@ jobs:
|
||||
detect-changes:
|
||||
runs-on: ubuntu-latest
|
||||
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:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Detect changed apps
|
||||
id: detect
|
||||
run: |
|
||||
# Get list of changed apps compared to previous commit
|
||||
if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then
|
||||
# Initial push - build all apps
|
||||
CHANGED_APPS=$(ls -d apps/*/ | sed 's|apps/||g' | sed 's|/||g' | jq -R -s -c 'split("\n")[:-1]')
|
||||
else
|
||||
# Compare with previous commit
|
||||
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))')
|
||||
fi
|
||||
|
||||
echo "changed-apps=$CHANGED_APPS" >> $GITHUB_OUTPUT
|
||||
echo "Changed apps: $CHANGED_APPS"
|
||||
uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
base: main
|
||||
filters: |
|
||||
bursatil:
|
||||
- 'apps/bursatil/**'
|
||||
ChatEgresos:
|
||||
- 'apps/ChatEgresos/**'
|
||||
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/**'
|
||||
|
||||
build-and-push:
|
||||
build-bursatil:
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.changed-apps != '[]'
|
||||
if: needs.detect-changes.outputs.bursatil == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
app: ${{ fromJson(needs.detect-changes.outputs.changed-apps) }}
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.GITEA_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.GITEA_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
|
||||
|
||||
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: ${{ 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: |
|
||||
PACKAGE=${{ matrix.app }}
|
||||
PACKAGE=bursatil
|
||||
|
||||
- name: Image summary
|
||||
run: |
|
||||
echo "### ✅ Built and pushed: ${{ matrix.app }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Image: ${{ steps.meta.outputs.image }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Tags: latest, ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
|
||||
build-ChatEgresos:
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.ChatEgresos == '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 }}-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
|
||||
|
||||
@@ -53,3 +53,8 @@ async def send(message: Message, stream: bool = False):
|
||||
agent, message.prompt, message.conversation_id
|
||||
)
|
||||
return response
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def health():
|
||||
return {"status": "ok"}
|
||||
|
||||
Reference in New Issue
Block a user