From 31fc59ad5230669fa8f5761f396bd5fc6762c3af Mon Sep 17 00:00:00 2001 From: Liora Milbaum Date: Mon, 8 Apr 2024 12:40:56 +0300 Subject: [PATCH] Release to quay after tests pass Signed-off-by: Liora Milbaum --- .github/workflows/chatbot.yaml | 12 +++--- .github/workflows/model_servers.yaml | 2 +- .github/workflows/testing-framework.yaml | 37 +++++++++++++++++++ .../llamacpp_python/tests/conftest.py | 2 +- model_servers/whispercpp/tests/conftest.py | 2 +- .../chatbot/tests/functional/conftest.py | 4 +- 6 files changed, 48 insertions(+), 11 deletions(-) diff --git a/.github/workflows/chatbot.yaml b/.github/workflows/chatbot.yaml index 03802e206..cce8f1b14 100644 --- a/.github/workflows/chatbot.yaml +++ b/.github/workflows/chatbot.yaml @@ -18,7 +18,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository_owner }}/chatbot + IMAGE_NAME: chatbot jobs: build-and-push-image: @@ -43,11 +43,11 @@ jobs: id: build_image uses: redhat-actions/buildah-build@v2.13 with: - image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + image: ${{ env.REGISTRY }}/containers/${{ env.IMAGE_NAME }} tags: latest platforms: linux/amd64, linux/arm64 - containerfiles: ./recipes/natural_language_processing/chatbot/builds/Containerfile - context: recipes/natural_language_processing/chatbot + containerfiles: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}/builds/Containerfile + context: recipes/natural_language_processing/${{ env.IMAGE_NAME }} - name: Set up Python uses: actions/setup-python@v5.0.0 @@ -55,13 +55,13 @@ jobs: python-version: '3.11' - name: Install Dependencies - working-directory: ./recipes/natural_language_processing/chatbot + working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }} run: make install - name: Run Functional Tests - working-directory: ./recipes/natural_language_processing/chatbot shell: bash run: make functional-tests + working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }} - name: Login to Registry if: github.event_name == 'push' && github.ref == 'refs/heads/main' diff --git a/.github/workflows/model_servers.yaml b/.github/workflows/model_servers.yaml index 1cec70af5..1f1639cec 100644 --- a/.github/workflows/model_servers.yaml +++ b/.github/workflows/model_servers.yaml @@ -49,7 +49,7 @@ jobs: id: build_image uses: redhat-actions/buildah-build@v2.13 with: - image: ${{ env.REGISTRY }}/${{ matrix.image_name }} + image: ${{ env.REGISTRY }}/${{ github.repository_owner}}/${{ matrix.image_name }} platforms: linux/amd64, linux/arm64 tags: latest containerfiles: ./model_servers/${{ matrix.image_name }}/base/Containerfile diff --git a/.github/workflows/testing-framework.yaml b/.github/workflows/testing-framework.yaml index d6244e566..be949d8b6 100644 --- a/.github/workflows/testing-framework.yaml +++ b/.github/workflows/testing-framework.yaml @@ -89,7 +89,44 @@ jobs: if: always() run: terraform destroy -auto-approve -lock=false working-directory: terraform-test-environment-module + + - name: Publish Job Results to Slack + id: slack + if: always() + uses: slackapi/slack-github-action@v1.25.0 + with: + payload: | + { + "text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + release-images: + runs-on: ubuntu-latest + needs: integration-tests + if: success() + strategy: + fail-fast: false + matrix: + include: + - image: llamacpp_python + - image: whispercpp + - image: chatbot + steps: + - name: Login to registry + uses: redhat-actions/podman-login@v1.7 + with: + registry: quay.io + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Copy image from one registry to another one + run: skopeo copy --all docker://${{ env.SOURCE_REGISTRY }}/${{ matrix.image }} docker://${{ env.TARGET_REGISTRY }}/${{ matrix.image }} + env: + SOURCE_REGISTRY: ghcr.io/containers + TARGET_REGISTRY: quay.io/ai-lab + - name: Publish Job Results to Slack id: slack if: always() diff --git a/model_servers/llamacpp_python/tests/conftest.py b/model_servers/llamacpp_python/tests/conftest.py index 4cd3e203d..380262b1f 100644 --- a/model_servers/llamacpp_python/tests/conftest.py +++ b/model_servers/llamacpp_python/tests/conftest.py @@ -2,7 +2,7 @@ import os MS = pytest_container.Container( - url=f"containers-storage:{os.environ['REGISTRY']}/{os.environ['IMAGE_NAME']}", + url=f"containers-storage:{os.environ['REGISTRY']}/containers/{os.environ['IMAGE_NAME']}", volume_mounts=[ pytest_container.container.BindMount( container_path="/locallm/models/model.gguf", diff --git a/model_servers/whispercpp/tests/conftest.py b/model_servers/whispercpp/tests/conftest.py index 4cd3e203d..380262b1f 100644 --- a/model_servers/whispercpp/tests/conftest.py +++ b/model_servers/whispercpp/tests/conftest.py @@ -2,7 +2,7 @@ import os MS = pytest_container.Container( - url=f"containers-storage:{os.environ['REGISTRY']}/{os.environ['IMAGE_NAME']}", + url=f"containers-storage:{os.environ['REGISTRY']}/containers/{os.environ['IMAGE_NAME']}", volume_mounts=[ pytest_container.container.BindMount( container_path="/locallm/models/model.gguf", diff --git a/recipes/natural_language_processing/chatbot/tests/functional/conftest.py b/recipes/natural_language_processing/chatbot/tests/functional/conftest.py index 81d1bd979..eb576868f 100644 --- a/recipes/natural_language_processing/chatbot/tests/functional/conftest.py +++ b/recipes/natural_language_processing/chatbot/tests/functional/conftest.py @@ -3,7 +3,7 @@ MS = pytest_container.Container( - url=f"containers-storage:{os.environ['REGISTRY']}/llamacpp_python", + url=f"containers-storage:{os.environ['REGISTRY']}/containers/llamacpp_python", volume_mounts=[ pytest_container.container.BindMount( container_path="/locallm/models", @@ -26,7 +26,7 @@ ) CB = pytest_container.Container( - url=f"containers-storage:{os.environ['REGISTRY']}/{os.environ['IMAGE_NAME']}", + url=f"containers-storage:{os.environ['REGISTRY']}/containers/{os.environ['IMAGE_NAME']}", extra_environment_variables={ "MODEL_SERVICE_ENDPOINT": "http://10.88.0.1:8001/v1" },