Skip to content
This repository has been archived by the owner on Feb 15, 2025. It is now read-only.

Commit

Permalink
Merge branch 'main' into renovate/fastapi-0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
justinthelaw authored Oct 4, 2024
2 parents 505db67 + fcd8087 commit d4cad2b
Show file tree
Hide file tree
Showing 188 changed files with 4,147 additions and 1,349 deletions.
174 changes: 174 additions & 0 deletions .github/actions/release/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: release
description: "Cut a release of all LeapfrogAI artifacts"

inputs:
releaseTag:
description: The release tag to be published, cannot be left empty
required: true
subRepository:
description: The sub-repository to publish the artifacts to
required: false
default: /uds/
registry1Username:
description: Registry1 Username
registry1Password:
description: Registry1 Password
ghToken:
description: GitHub Token
chainguardIdentity:
description: Chainguard login identity

runs:
using: composite

steps:
- name: Setup UDS Environment
uses: defenseunicorns/uds-common/.github/actions/setup@e3008473beab00b12a94f9fcc7340124338d5c08 # v0.13.1
with:
registry1Username: ${{ inputs.registry1Username }}
registry1Password: ${{ inputs.registry1Password }}
ghToken: ${{ inputs.ghToken }}
chainguardIdentity: ${{ inputs.chainguardIdentity }}

- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0

- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version-file: "pyproject.toml"

- name: Install Dev Dependencies
shell: bash
run: |
python -m pip install ".[dev]" ".[dev-vllm]" ".[dev-whisper]"
- name: Build and Publish K3d GPU
shell: bash
run: |
cd packages/k3d-gpu
docker build \
--platform linux/amd64 \
-t ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:${{ inputs.releaseTag }} .
docker push ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:${{ inputs.releaseTag }}
cd ../..
- name: Download Python Wheels and Publish Builder Image
shell: bash
run: |
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-sdk:${{ inputs.releaseTag }} --push -f src/leapfrogai_sdk/Dockerfile .
- name: Install Zarf
uses: defenseunicorns/setup-zarf@10e539efed02f75ec39eb8823e22a5c795f492ae #v1.0.1

- name: Build and Publish API
shell: bash
run: |
docker buildx build --platform amd64,arm64 --build-arg LOCAL_VERSION=${{ inputs.releaseTag }} -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api:${{ inputs.releaseTag }} --push -f packages/api/Dockerfile .
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/api-migrations:${{ inputs.releaseTag }} --push -f Dockerfile.migrations --build-arg="MIGRATIONS_DIR=packages/api/supabase/migrations" .
zarf package create packages/api --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture amd64 --flavor upstream --confirm
zarf package create packages/api --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture arm64 --flavor upstream --confirm
zarf package publish zarf-package-leapfrogai-api-amd64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
zarf package publish zarf-package-leapfrogai-api-arm64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
docker image prune -af
rm zarf-package-leapfrogai-api-*.tar.zst
- name: Build and Publish UI
shell: bash
run: |
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:${{ inputs.releaseTag }} --push src/leapfrogai_ui
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/ui-migrations:${{ inputs.releaseTag }} --push -f Dockerfile.migrations --build-arg="MIGRATIONS_DIR=src/leapfrogai_ui/supabase/migrations" .
zarf package create packages/ui --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture amd64 --flavor upstream --confirm
zarf package create packages/ui --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture arm64 --flavor upstream --confirm
zarf package publish zarf-package-leapfrogai-ui-amd64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
zarf package publish zarf-package-leapfrogai-ui-arm64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
docker image prune -af
rm zarf-package-leapfrogai-ui-*.tar.zst
- name: Build and Publish Supabase
shell: bash
run: |
docker buildx build --platform amd64,arm64 -t ghcr.io/defenseunicorns/leapfrogai/supabase-migrations:${{ inputs.releaseTag }} --push -f Dockerfile.migrations --build-arg="MIGRATIONS_DIR=packages/supabase/migrations" .
zarf package create packages/supabase --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture amd64 --flavor upstream --confirm
zarf package create packages/supabase --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture arm64 --flavor upstream --confirm
zarf package publish zarf-package-supabase-amd64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
zarf package publish zarf-package-supabase-arm64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
- name: Build and Publish Repeater
shell: bash
run: |
docker buildx build --platform amd64,arm64 --build-arg LOCAL_VERSION=${{ inputs.releaseTag }} -t ghcr.io/defenseunicorns/leapfrogai/repeater:${{ inputs.releaseTag }} --push -f packages/repeater/Dockerfile .
zarf package create packages/repeater --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture amd64 --flavor upstream --confirm
zarf package create packages/repeater --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture arm64 --flavor upstream --confirm
zarf package publish zarf-package-repeater-amd64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
zarf package publish zarf-package-repeater-arm64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
docker image prune -af
rm zarf-package-repeater-*.tar.zst
- name: Build and Publish LLaMA-CPP-Python
shell: bash
run: |
docker buildx build --platform amd64,arm64 --build-arg LOCAL_VERSION=${{ inputs.releaseTag }} -t ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python:${{ inputs.releaseTag }} --push -f packages/llama-cpp-python/Dockerfile .
zarf package create packages/llama-cpp-python --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture amd64 --flavor upstream --confirm
zarf package create packages/llama-cpp-python --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture arm64 --flavor upstream --confirm
zarf package publish zarf-package-llama-cpp-python-amd64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
zarf package publish zarf-package-llama-cpp-python-arm64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
docker image prune -af
rm zarf-package-llama-*.tar.zst
- name: Build and Publish vLLM
shell: bash
run: |
docker buildx build --build-arg LOCAL_VERSION=${{ inputs.releaseTag }} -t ghcr.io/defenseunicorns/leapfrogai/vllm:${{ inputs.releaseTag }} --push -f packages/vllm/Dockerfile .
ZARF_CONFIG=packages/vllm/zarf-config.yaml zarf package create packages/vllm --set=IMAGE_VERSION=${{ inputs.releaseTag }} --flavor upstream --confirm
zarf package publish zarf-package-vllm-amd64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
docker image prune -af
rm zarf-package-vllm-*.tar.zst
- name: Build and Publish Text-Embeddings
shell: bash
run: |
docker buildx build --platform amd64,arm64 --build-arg LOCAL_VERSION=${{ inputs.releaseTag }} -t ghcr.io/defenseunicorns/leapfrogai/text-embeddings:${{ inputs.releaseTag }} --push -f packages/text-embeddings/Dockerfile .
zarf package create packages/text-embeddings --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture amd64 --flavor upstream --confirm
zarf package create packages/text-embeddings --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture arm64 --flavor upstream --confirm
zarf package publish zarf-package-text-embeddings-amd64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
zarf package publish zarf-package-text-embeddings-arm64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
docker image prune -af
rm zarf-package-text-embeddings-*.tar.zst
- name: Build and Publish Whisper
shell: bash
run: |
docker buildx build --platform amd64,arm64 --build-arg LOCAL_VERSION=${{ inputs.releaseTag }} -t ghcr.io/defenseunicorns/leapfrogai/whisper:${{ inputs.releaseTag }} --push -f packages/whisper/Dockerfile .
zarf package create packages/whisper --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture amd64 --flavor upstream --confirm
zarf package create packages/whisper --set=IMAGE_VERSION=${{ inputs.releaseTag }} --architecture arm64 --flavor upstream --confirm
zarf package publish zarf-package-whisper-amd64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
zarf package publish zarf-package-whisper-arm64-${{ inputs.releaseTag }}.tar.zst oci://ghcr.io/defenseunicorns/packages${{ inputs.subRepository }}leapfrogai
docker image prune -af
rm zarf-package-whisper-*.tar.zst
6 changes: 4 additions & 2 deletions .github/actions/uds-cluster/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ inputs:
description: Registry1 Password
ghToken:
description: GitHub Token
chainguardIdentity:
description: Chainguard login identity

runs:
using: composite
Expand All @@ -18,10 +20,10 @@ runs:
registry1Username: ${{ inputs.registry1Username }}
registry1Password: ${{ inputs.registry1Password }}
ghToken: ${{ inputs.ghToken }}
udsCliVersion: 0.14.0
chainguardIdentity: ${{ inputs.chainguardIdentity }}

- name: Checkout Repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Create UDS Cluster
shell: bash
Expand Down
5 changes: 5 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"path": "**/zarf.yaml",
"glob": true
},
{
"type": "generic",
"path": "**/zarf-config.yaml",
"glob": true
},
{
"type": "generic",
"path": "**/uds-bundle.yaml",
Expand Down
180 changes: 180 additions & 0 deletions .github/scripts/uds_verification_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
#!/usr/bin/env python3

import os
import re


def remove_ansi_escape_sequences(text):
ansi_escape = re.compile(r"\x1B\[[0-?]*[ -/]*[@-~]")
return ansi_escape.sub("", text)


# Capabilities that affect the entire capability, not just a single package
def uds_capability_wide_errors(text: str) -> bool:
if "Not all pods have the istio sidecar" in text:
return True
return False


# CI environment variable enables GitHub annotations
def print_package_info(
package_name,
failures_count,
errors_count,
warnings_count,
failure_descriptions,
error_descriptions,
warning_descriptions,
uds_capability_wide_errors_count,
):
if uds_capability_wide_errors_count >= 1:
errors_count -= uds_capability_wide_errors_count
if package_name:
print("-----------------------------")
if os.getenv("CI") == "true":
print(f"::group::{package_name}")
print(f"Package: {package_name}\n")
if failures_count > 0:
if os.getenv("CI") == "true":
print("::error::", end="")
print(f"⛔ Failures: {failures_count}")
else:
if errors_count > 0:
if os.getenv("CI") == "true":
print("::error::", end="")
print(f"❌ Errors: {errors_count}")
if warnings_count > 0:
if os.getenv("CI") == "true":
print("::warning::", end="")
print(f"⚠️ Warnings: {warnings_count}")
if failures_count > 0:
print("\n⛔ Failure Descriptions:")
for desc in failure_descriptions:
print(f" - {desc}")
else:
if errors_count > 0:
print("\n❌ Error Descriptions:")
for desc in error_descriptions:
print(f" - {desc}")
if warnings_count > 0:
print("\n⚠️ Warning Descriptions:")
for desc in warning_descriptions:
print(f" - {desc}")
if os.getenv("CI") == "true":
print("::endgroup::")


def main():
# Read data from the specified file instead of stdin
file_path = os.path.join(
os.getenv("GITHUB_WORKSPACE", ""), "reports/intermediate-report.txt"
)
with open(file_path, mode="r", encoding="utf-8", errors="ignore") as file:
data = file.read()
# Remove ANSI escape sequences
clean_data = remove_ansi_escape_sequences(data)
# Initialize variables
package_name = ""
failures_count = 0
errors_count = 0
warnings_count = 0
uds_capability_wide_errors_count = 0
failure_descriptions = []
error_descriptions = []
warning_descriptions = []
uds_capability_wide_error_descriptions = []
previous_package_name = None

# Process each line
for line in clean_data.splitlines():
# Remove leading and trailing whitespace
line = line.strip()

# Match and extract the package name
match = re.match(r"^ℹ️\s+Package\s+Name:\s+(.*)$", line)
if match:
# Print the previous package's info before starting a new one
if previous_package_name is not None:
print_package_info(
previous_package_name,
failures_count,
errors_count,
warnings_count,
failure_descriptions,
error_descriptions,
warning_descriptions,
uds_capability_wide_errors_count,
)
# Reset variables for the new package
package_name = match.group(1)
failures_count = 0
errors_count = 0
warnings_count = 0
failure_descriptions = []
error_descriptions = []
warning_descriptions = []
previous_package_name = package_name
continue

if uds_capability_wide_errors(line):
uds_capability_wide_errors_count = 1
uds_capability_wide_error_descriptions = [
"Not all pods have the istio sidecar"
]
continue
else:
# Match and extract counts for failures, errors, and warnings
match = re.match(r"^(❌|⚠️|⛔)\s+(\d+)\s+([a-z]+)\s+found$", line)
if match:
count = int(match.group(2))
type_ = match.group(3)
if type_ == "errors":
errors_count = count
elif type_ == "warnings":
warnings_count = count
elif type_ == "failures":
failures_count = count
continue

# Match and collect issue descriptions
match = re.match(r"^(❌|⚠️|⛔)\s+(.*)$", line)
if match:
emoji = match.group(1)
description = match.group(2)
if emoji == "❌":
error_descriptions.append(description)
elif emoji == "⚠️":
warning_descriptions.append(description)
elif emoji == "⛔":
failure_descriptions.append(description)
continue

# Print the last package's information
if previous_package_name is not None:
print_package_info(
previous_package_name,
failures_count,
errors_count,
warnings_count,
failure_descriptions,
error_descriptions,
warning_descriptions,
uds_capability_wide_errors_count,
)
if uds_capability_wide_errors_count >= 1:
print("-----------------------------")
if os.getenv("CI") == "true":
print("::group::UDS Capability-Wide Issues")
print("::error::", end="")
print("UDS Capability Issues")
print("\n❌ Error Descriptions:")
for desc in uds_capability_wide_error_descriptions:
print(f" - {desc}")
if os.getenv("CI") == "true":
print("::endgroup::")


if __name__ == "__main__":
main()
# Print the final ending separator
print("-----------------------------")
2 changes: 1 addition & 1 deletion .github/workflows/commit-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0

Expand Down
Loading

0 comments on commit d4cad2b

Please sign in to comment.