diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index f906032a3..8a45a86d6 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -3,11 +3,11 @@ name: pytest on: pull_request: types: - - opened # default trigger - - reopened # default trigger - - synchronize # default trigger - - ready_for_review # don't run on draft PRs - - milestoned # allows us to trigger on bot PRs + - opened # default trigger + - reopened # default trigger + - synchronize # default trigger + - ready_for_review # don't run on draft PRs + - milestoned # allows us to trigger on bot PRs paths: - "**" - "!.github/**" @@ -58,10 +58,10 @@ jobs: - name: Setup Repeater env: - LOCAL_VERSION: e2e-test + VERSION: e2e-test run: | - make docker-repeater - docker run -p 50051:50051 -d --name=repeater ghcr.io/defenseunicorns/leapfrogai/repeater:$LOCAL_VERSION + uds run create:repeater-image --set VERSION=${VERSION} + uds run deploy:repeater-image --set VERSION=${VERSION} - name: Run Pytest run: make test-api-unit @@ -90,10 +90,10 @@ jobs: - name: Setup Repeater env: - LOCAL_VERSION: e2e-test + VERSION: e2e-test run: | - make docker-repeater - docker run -p 50051:50051 -d --name=repeater ghcr.io/defenseunicorns/leapfrogai/repeater:$LOCAL_VERSION + uds run create:repeater-image --set VERSION=${VERSION} + uds run deploy:repeater-image --set VERSION=${VERSION} - name: Setup UDS Cluster uses: ./.github/actions/uds-cluster diff --git a/packages/k3d-gpu/README.md b/packages/k3d-gpu/README.md index 1a67e353b..8d2837000 100644 --- a/packages/k3d-gpu/README.md +++ b/packages/k3d-gpu/README.md @@ -13,25 +13,25 @@ All system requirements and pre-requisites from the [LeapfrogAI documentation we ### Deployment > [!NOTE] -> The following Make targets can be executed from the root of the LeapfrogAI repository or within this sub-directory. +> The following UDS Tasks must be executed from the root of the LeapfrogAI repository. To deploy a new K3d cluster with [UDS Core Slim Dev](https://github.com/defenseunicorns/uds-core#uds-package-development), use one of the following Make targets. ```bash -make create-uds-gpu-cluster # create a uds cluster equipped with the k3d-gpu image +uds run setup:k3d-gpu-cluster-slim # create a uds cluster equipped with the k3d-gpu image -make test-uds-gpu-cluster # deploy a test gpu pod to see if everything is working +uds run test:k3d-gpu-cluster # deploy a test gpu pod to see if everything is working ``` ### Local Development > [!NOTE] -> The following Make targets can be executed from the root of the LeapfrogAI repository or within this sub-directory +> The following UDS Tasks must be executed from the root of the LeapfrogAI repository. To build **just** the K3s CUDA image for container debugging, use the following Make target. ```bash -make build-k3d-gpu # build the image +uds run create:k3d-gpu-image # build the image ``` ## References diff --git a/tasks.yaml b/tasks.yaml index 5faa1c037..e950f159b 100644 --- a/tasks.yaml +++ b/tasks.yaml @@ -39,6 +39,7 @@ includes: - setup: ./tasks/setup.yaml - deploy: ./tasks/deploy.yaml - utils: ./tasks/utils.yaml + - test: ./tasks/test.yaml tasks: ####### diff --git a/tasks/create.yaml b/tasks/create.yaml index a01cc1907..7e1a8cb9a 100644 --- a/tasks/create.yaml +++ b/tasks/create.yaml @@ -189,7 +189,7 @@ tasks: dockerfile: "packages/k3d-gpu/Dockerfile" architecture: "amd64" version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/k3d-gpu + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/k3d-gpu" buildContext: "packages/k3d-gpu" - name: sdk-image @@ -226,16 +226,7 @@ tasks: buildOptions: "--build-arg='MIGRATIONS_DIR=packages/supabase/migrations'" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/api-migrations - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/api-migrations:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/api-migrations:${VERSION}" - override: "true" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/api-migrations:${VERSION}" - override: "true" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/api-migrations" - name: api-image description: "Build the upstream LeapfrogAI API image" @@ -249,7 +240,7 @@ tasks: task: sdk-image with: architecture: ${ARCHITECTURE} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk" - description: "Create the API image" task: image @@ -257,14 +248,7 @@ tasks: dockerfile: "packages/api/Dockerfile" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-api:${VERSION}" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-api:${VERSION}" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api" - name: ui-migrations-image description: "Build the upstream LeapfrogAI UI migrations image" @@ -282,16 +266,7 @@ tasks: buildOptions: "--build-arg='MIGRATIONS_DIR=packages/supabase/migrations'" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/ui-migrations - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/ui-migrations:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/ui-migrations:${VERSION}" - override: "true" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/ui-migrations:${VERSION}" - override: "true" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/ui-migrations" - name: ui-image description: "Build the upstream LeapfrogAI API image" @@ -308,14 +283,7 @@ tasks: buildContext: "src/leapfrogai_ui" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION}" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION}" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui" - name: supabase-migrations-image description: "Build the upstream Supabase migrations image" @@ -333,16 +301,7 @@ tasks: buildOptions: "--build-arg='MIGRATIONS_DIR=packages/supabase/migrations'" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/supabase-migrations - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/supabase-migrations:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/supabase-migrations:${VERSION}" - override: "true" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/supabase-migrations:${VERSION}" - override: "true" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/supabase-migrations" - name: repeater-image description: "Build the upstream Repeater image" @@ -352,20 +311,19 @@ tasks: name: ${LOCAL_REGISTRY_NAME} port: ${LOCAL_REGISTRY_PORT} + - description: "Create the SDK image" + task: sdk-image + with: + architecture: ${ARCHITECTURE} + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk" + - description: "Create the Repeater image" task: image with: dockerfile: "packages/repeater/Dockerfile" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/repeater - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/repeater:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/repeater:${VERSION}" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/repeater:${VERSION}" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/repeater" - name: vllm-image description: "Build the upstream vLLM image" @@ -375,20 +333,19 @@ tasks: name: ${LOCAL_REGISTRY_NAME} port: ${LOCAL_REGISTRY_PORT} + - description: "Create the SDK image" + task: sdk-image + with: + architecture: ${ARCHITECTURE} + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk" + - description: "Create the vLLM image" task: image with: dockerfile: "packages/vllm/Dockerfile" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/vllm - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/vllm:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/vllm:${VERSION}" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/vllm:${VERSION}" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/vllm" - name: llama-cpp-python-image description: "Build the upstream LLaMA-CPP-Python image" @@ -398,20 +355,19 @@ tasks: name: ${LOCAL_REGISTRY_NAME} port: ${LOCAL_REGISTRY_PORT} + - description: "Create the SDK image" + task: sdk-image + with: + architecture: ${ARCHITECTURE} + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk" + - description: "Create the LLaMA-CPP-Python image" task: image with: dockerfile: "packages/llama-cpp-python/Dockerfile" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/llama-cpp-python:${VERSION}" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/llama-cpp-python:${VERSION}" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python" - name: text-embeddings-image description: "Build the upstream Text-Embeddings image" @@ -421,20 +377,19 @@ tasks: name: ${LOCAL_REGISTRY_NAME} port: ${LOCAL_REGISTRY_PORT} + - description: "Create the SDK image" + task: sdk-image + with: + architecture: ${ARCHITECTURE} + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk" + - description: "Create the Text-Embeddings image" task: image with: dockerfile: "packages/text-embeddings/Dockerfile" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/text-embeddings - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/text-embeddings:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/text-embeddings:${VERSION}" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/text-embeddings:${VERSION}" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/text-embeddings" - name: whisper-image description: "Build the upstream Whisper image" @@ -444,20 +399,19 @@ tasks: name: ${LOCAL_REGISTRY_NAME} port: ${LOCAL_REGISTRY_PORT} + - description: "Create the SDK image" + task: sdk-image + with: + architecture: ${ARCHITECTURE} + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk" + - description: "Create the Whisper image" task: image with: dockerfile: "packages/whisper/Dockerfile" architecture: ${ARCHITECTURE} version: ${VERSION} - imageRepository: ghcr.io/defenseunicorns/leapfrogai/whisper - - task: utils:tag - with: - current: "ghcr.io/defenseunicorns/leapfrogai/whisper:${VERSION}" - new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/whisper:${VERSION}" - - task: utils:docker - with: - tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/whisper:${VERSION}" + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/whisper" ########## # PACKAGES @@ -467,7 +421,25 @@ tasks: description: "Build the LeapfrogAI API Zarf package" actions: - task: api-migrations-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/api-migrations:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/api-migrations:${VERSION}" + override: "true" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/api-migrations:${VERSION}" + override: "true" + - task: api-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-api:${VERSION}" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-api:${VERSION}" + - task: package with: path: "packages/api" @@ -483,7 +455,25 @@ tasks: description: "Build the LeapfrogAI UI Zarf package" actions: - task: ui-migrations-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/ui-migrations:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/ui-migrations:${VERSION}" + override: "true" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/ui-migrations:${VERSION}" + override: "true" + - task: ui-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION}" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION}" + - task: package with: path: "packages/ui" @@ -499,6 +489,16 @@ tasks: description: "Build the Supabase Zarf package" actions: - task: supabase-migrations-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/supabase-migrations:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/supabase-migrations:${VERSION}" + override: "true" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/supabase-migrations:${VERSION}" + override: "true" + - task: package with: path: "packages/supabase" @@ -513,6 +513,14 @@ tasks: description: "Build the Repeater Zarf package" actions: - task: repeater-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/repeater:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/repeater:${VERSION}" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/repeater:${VERSION}" + - task: package with: path: "packages/repeater" @@ -527,6 +535,14 @@ tasks: description: "Build the vLLM Zarf package" actions: - task: vllm-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/vllm:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/vllm:${VERSION}" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/vllm:${VERSION}" + - task: package with: path: "packages/vllm" @@ -542,6 +558,14 @@ tasks: description: "Build the LLaMA-CPP-Python Zarf package" actions: - task: llama-cpp-python-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/llama-cpp-python:${VERSION}" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/llama-cpp-python:${VERSION}" + - task: package with: path: "packages/llama-cpp-python" @@ -556,6 +580,14 @@ tasks: description: "Build the Text-Embeddings Zarf package" actions: - task: text-embeddings-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/text-embeddings:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/text-embeddings:${VERSION}" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/text-embeddings:${VERSION}" + - task: package with: path: "packages/text-embeddings" @@ -570,6 +602,14 @@ tasks: description: "Build the Whisper Zarf package" actions: - task: whisper-image + - task: utils:tag + with: + current: "ghcr.io/defenseunicorns/leapfrogai/whisper:${VERSION}" + new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/whisper:${VERSION}" + - task: utils:docker + with: + tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/whisper:${VERSION}" + - task: package with: path: "packages/whisper" diff --git a/tasks/deploy.yaml b/tasks/deploy.yaml index 39ef8d166..1ba98cf5c 100644 --- a/tasks/deploy.yaml +++ b/tasks/deploy.yaml @@ -15,6 +15,45 @@ tasks: # REUSEABLE ########### + - name: image + description: "Run a Docker image" + inputs: + name: + description: "Name to tag the running container with" + required: true + options: + description: "Extra Docker CLI options" + default: "-q -d --rm" + required: false + version: + description: "Set the version of the Docker image" + required: true + imageRepository: + description: "Image repository for the image tag" + required: true + containerPort: + description: "Container port to expose" + required: true + hostPort: + description: "Host port to expose container port at" + required: true + actions: + - task: utils:log + with: + log: "Running the image ${{ .inputs.name }}" + - description: "Run the Docker image" + shell: + linux: bash + darwin: bash + cmd: | + docker run \ + -p ${{ .inputs.hostPort }}:${{ .inputs.containerPort }} \ + --name=${{ .inputs.name }} ${{ .inputs.options }} \ + ${{ .inputs.imageRepository }}:${{ .inputs.version }} + - task: utils:log + with: + log: "Docker image, ${{ .inputs.name }}, is now running!" + - name: package description: "Deploy a Zarf package" inputs: @@ -75,6 +114,21 @@ tasks: options: ${{ .inputs.options }} path: ${{ .inputs.path }} + ######## + # IMAGES + ######## + + - name: repeater-image + description: "Run the Repeater Docker container" + actions: + - task: image + with: + name: "repeater" + version: ${VERSION} + imageRepository: "ghcr.io/defenseunicorns/leapfrogai/repeater" + containerPort: "50051" + hostPort: "50051" + ########## # PACKAGES ########## diff --git a/tasks/test.yaml b/tasks/test.yaml new file mode 100644 index 000000000..3ff3791e0 --- /dev/null +++ b/tasks/test.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/defenseunicorns/uds-cli/v0.14.0/tasks.schema.json + +tasks: + ######### + # CLUSTER + ######### + + - name: k3d-gpu-cluster + description: "Tests CUDA GPU scheduling and capability within the UDS K3d cluster" + actions: + - description: "Deploy the vector addition test pod to the cluster" + cmd: | + uds zarf tools kubectl apply -f packages/k3d-gpu/test/cuda-vector-add.yaml + - description: "Await test completion and then display the test results" + cmd: | + uds zarf tools wait-for Pod gpu-pod '{.status.phase}'=Succeeded -n default --no-progress + uds zarf tools kubectl logs -l app=gpu-pod -n default + - description: "Remove the completed test pod" + cmd: | + uds zarf tools kubectl delete Pod gpu-pod