Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: add containerization and packaging manifest lints #937

Merged
merged 67 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
470e5bc
add docker uds zarf helm lints
justinthelaw Aug 20, 2024
d19bc13
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Aug 20, 2024
95e87f8
fix uds lint dir
justinthelaw Aug 20, 2024
717f22e
wip
justinthelaw Aug 20, 2024
f30fd16
Dockerfile edits
justinthelaw Aug 20, 2024
7d627d9
paths for Dockerfile
justinthelaw Aug 20, 2024
9bd87a1
paths for UDS and Zarf
justinthelaw Aug 20, 2024
21ae1a4
hadolint config changes
justinthelaw Aug 20, 2024
291de3b
hadolint config changes, pt.2
justinthelaw Aug 20, 2024
e5f4558
hadolint config changes, pt.3
justinthelaw Aug 20, 2024
fac06e9
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Aug 29, 2024
a2b0920
hadolint, docker lint configs and helm lint
justinthelaw Aug 30, 2024
0c923bb
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Aug 30, 2024
3f2f808
text-embeddings fixes
justinthelaw Aug 30, 2024
5485503
pre-commit fixes
justinthelaw Aug 30, 2024
b1307b3
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Aug 30, 2024
8d7be63
llama-cpp-python fixes
justinthelaw Aug 30, 2024
c5dbaa0
whisper and other fixes
justinthelaw Aug 30, 2024
2ab7327
whisper, vllm, repeater, many fixes
justinthelaw Sep 3, 2024
9b6dbdd
fix vllm Dockerfile lint warnings
justinthelaw Sep 3, 2024
a719d25
merge with main fixes
justinthelaw Sep 3, 2024
27ca92d
add and run all lints separately
justinthelaw Sep 3, 2024
45aa1d3
vllm double quotes expansion
justinthelaw Sep 3, 2024
3bc117f
minor UI fixes
justinthelaw Sep 3, 2024
619aab3
rollback extraneous securityContext
justinthelaw Sep 3, 2024
79dca84
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Sep 3, 2024
2b16406
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Sep 3, 2024
7fac00d
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Sep 4, 2024
bd7e7ba
minor migrations and UI fixes
justinthelaw Sep 4, 2024
0723794
many values and manifest fixes
justinthelaw Sep 4, 2024
381c93f
Merge remote-tracking branch 'origin/main' into 706-lint-uds-helm-doc…
justinthelaw Sep 4, 2024
f7fcaad
remove supabase from pre-commit hook
justinthelaw Sep 4, 2024
263399c
fix uds-lint
justinthelaw Sep 4, 2024
87b9ebb
namespace default, global context
justinthelaw Sep 4, 2024
b35b531
skip registry1 e2e on draft PRs
justinthelaw Sep 4, 2024
6322757
log level, service fixes
justinthelaw Sep 4, 2024
5444eff
attempt fix migrations issues
justinthelaw Sep 4, 2024
301e860
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Sep 4, 2024
43f44c2
injector fix for llama, vllm confz fix
justinthelaw Sep 5, 2024
4788ef3
improve cleaning of build artifacts in Makefile
justinthelaw Sep 5, 2024
fb56b56
one more clean improvement
justinthelaw Sep 5, 2024
1b4df8e
mention #984, fix UI Zarf variable string
justinthelaw Sep 5, 2024
3134908
fix UI keycloak var, gpu_runtime
justinthelaw Sep 5, 2024
65a68c3
yaml server pointer corrected
justinthelaw Sep 5, 2024
b30eaa3
fix GPU Zarf Var in values files
justinthelaw Sep 5, 2024
a0ef924
JPerr review fixes Sept 5 2024 1349 EST
justinthelaw Sep 5, 2024
03ca891
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Sep 5, 2024
c464daf
JPerr review fixes Sept 5 2024 1349 EST, pt.2
justinthelaw Sep 5, 2024
eb25054
remove extra workdir
justinthelaw Sep 5, 2024
35b34b4
helm templating and e2e test fixes
justinthelaw Sep 6, 2024
c93918f
typo in comment e2e registry1
justinthelaw Sep 6, 2024
733c81d
pin registry1 weekly git checkout
justinthelaw Sep 6, 2024
e788eaa
version with the v
justinthelaw Sep 6, 2024
8c55deb
uds-cluster action hardcode
justinthelaw Sep 6, 2024
fc573a3
revert e2e registry1 to 0.11.0 state
justinthelaw Sep 6, 2024
fc99355
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Sep 6, 2024
bf83d01
more 0.11.0 shennanigans
justinthelaw Sep 6, 2024
b0c9e28
more 0.11.0 workarounds
justinthelaw Sep 6, 2024
2e64f07
more 0.11.0 workarounds, pt.2
justinthelaw Sep 6, 2024
d93b3e6
disable keycloak again
justinthelaw Sep 6, 2024
bce13e1
Merge branch 'main' into 706-lint-uds-helm-docker-zarf-lints
justinthelaw Sep 6, 2024
c7b0363
bump to 0.12.2, merge with main
justinthelaw Sep 7, 2024
95b652d
fix registry1 weekly bunlde pointer
justinthelaw Sep 7, 2024
9ab5658
typo in text-embeddings comments
justinthelaw Sep 9, 2024
36d9854
Merge remote-tracking branch 'origin/main' into 706-lint-uds-helm-doc…
justinthelaw Sep 10, 2024
2893f7c
merge origin main, 0.12.2 registry1 published
justinthelaw Sep 10, 2024
71476f4
merge with main, fixes
justinthelaw Sep 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
**/*.tar.zst
**/*.log*
**/__pycache__
**/.ruff_cache
**/Dockerfile*
**/.gitignore
**/Makefile
**/Makefile
**/node_modules
**/.svelte-kit
**/zarf-sbom/
**/zarf-*.tar.zst
5 changes: 5 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
"type": "generic",
"path": "**/hugo.toml",
"glob": true
},
{
"type": "generic",
"path": ".github/workflows/e2e-registry1-weekly.yaml",
"glob": true
}
]
}
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/docker-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docker Lint

on:
pull_request:
branches:
- "main"
paths:
- "**/Dockerfile"
- "**/Dockerfile.migrations"
- "**/.dockerignore"
- ".github/workflows/docker-lint.yaml"

concurrency:
group: docker-lint-${{ github.ref }}
cancel-in-progress: true

jobs:
docker-lint:
runs-on: ubuntu-latest
name: Lint Docker Manifest

permissions:
contents: write

steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

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

- uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0
with:
dockerfile: "*Dockerfile*"
recursive: true
config: .hadolint.yaml
37 changes: 17 additions & 20 deletions .github/workflows/e2e-registry1-weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
test-flavors:
runs-on: ai-ubuntu-big-boy-8-core
name: e2e_registry1_weekly
if: ${{ !github.event.pull_request.draft }}

permissions:
contents: read
Expand All @@ -36,16 +37,27 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# x-release-please-start-version
ref: "v0.12.2"
# x-release-please-end

- name: Setup Python
uses: ./.github/actions/python

- name: Setup UDS Cluster
uses: ./.github/actions/uds-cluster
# TODO: remove hardcoded uds-cluster action due to incorrect usage in v0.12.2
- name: Setup UDS Environment
uses: defenseunicorns/uds-common/.github/actions/setup@822dac4452e6815aadcf09f487406ff258756a0c # v0.14.0
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}
udsCliVersion: 0.14.0

- name: Create UDS Cluster
shell: bash
run: |
make create-uds-cpu-cluster

- name: Setup Playwright
run: |
Expand All @@ -58,6 +70,7 @@ jobs:

# Mutate UDS bundle definition to use Registry1 packages
- name: Mutation to Registry1 Bundle
# TODO: fix bundle path
run: |
uds zarf tools yq -i '.packages[1] |= del(.repository)' bundles/latest/cpu/uds-bundle.yaml
uds zarf tools yq -i '.packages[1] |= .ref = "registry1"' bundles/latest/cpu/uds-bundle.yaml
Expand All @@ -68,29 +81,20 @@ jobs:
run: |
cd bundles/latest/cpu
uds create . --confirm && \
uds deploy uds-bundle-leapfrogai-amd64-registry1.tar.zst \
--set LEAPFROGAI_API_BASE_URL="http://leapfrogai-api.leapfrogai.svc.cluster.local:8080" --confirm --no-progress && \
uds deploy --set DISABLE_KEYCLOAK=true uds-bundle-leapfrogai-amd64-registry1.tar.zst --confirm --no-progress && \
rm -rf uds-bundle-leapfrogai-amd64-registry1.tar.zst && \
docker system prune -af

- name: Generate Secrets
id: generate_secrets
run: |
PASSWORD=$(cat <(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9!@#$%^&*()_+-=[]{}|;:,.<>?' | head -c 20) <(echo '!@1Aa') | fold -w1 | shuf | tr -d '\n')
echo "::add-mask::$PASSWORD"
echo "FAKE_E2E_USER_PASSWORD=$PASSWORD" >> $GITHUB_OUTPUT
ANON_KEY=$(uds zarf tools kubectl get secret supabase-bootstrap-jwt -n leapfrogai -o jsonpath='{.data.anon-key}' | base64 -d)
echo "::add-mask::$ANON_KEY"
echo "ANON_KEY=$ANON_KEY" >> $GITHUB_OUTPUT
SERVICE_ROLE_KEY=$(uds zarf tools kubectl get secret -n leapfrogai supabase-bootstrap-jwt -o jsonpath={.data.service-key} | base64 -d)
echo "::add-mask::$SERVICE_ROLE_KEY"
echo "SERVICE_ROLE_KEY=$SERVICE_ROLE_KEY" >> $GITHUB_OUTPUT

- name: Verify Secrets
run: |
echo "FAKE_E2E_USER_PASSWORD is set: ${{ steps.generate_secrets.outputs.FAKE_E2E_USER_PASSWORD != '' }}"
echo "ANON_KEY is set: ${{ steps.generate_secrets.outputs.ANON_KEY != '' }}"
echo "SERVICE_ROLE_KEY is set: ${{ steps.generate_secrets.outputs.SERVICE_ROLE_KEY != '' }}"

# Backends
- name: Run Backend Tests
Expand All @@ -105,18 +109,11 @@ jobs:

- name: Run Playwright E2E Tests
env:
SERVICE_ROLE_KEY: ${{ steps.generate_secrets.outputs.SERVICE_ROLE_KEY }}
FAKE_E2E_USER_PASSWORD: ${{ steps.generate_secrets.outputs.FAKE_E2E_USER_PASSWORD }}
ANON_KEY: ${{ steps.generate_secrets.outputs.ANON_KEY }}
run: |
chmod +x ./.github/scripts/createUser.sh
./.github/scripts/createUser.sh

cp src/leapfrogai_ui/.env.example src/leapfrogai_ui/.env
mkdir -p playwright/auth
touch playwright/auth.user.json

SERVICE_ROLE_KEY=$SERVICE_ROLE_KEY TEST_ENV=CI USERNAME=doug PASSWORD=$FAKE_E2E_USER_PASSWORD PUBLIC_SUPABASE_ANON_KEY=$ANON_KEY npm --prefix src/leapfrogai_ui run test:integration:ci
TEST_ENV=CI PUBLIC_DISABLE_KEYCLOAK=true PUBLIC_SUPABASE_ANON_KEY=$ANON_KEY npm --prefix src/leapfrogai_ui run test:integration:ci

- name: Archive Playwright Report
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/helm-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Helm Lint

on:
pull_request:
branches:
- "main"
paths:
- "**/chart"
- "**/values"
- "**/*values.yaml"
- ".github/workflows/helm-lint.yaml"

concurrency:
group: helm-lint-${{ github.ref }}
cancel-in-progress: true

jobs:
helm-lint:
runs-on: ubuntu-latest
name: Lint Helm Charts

permissions:
contents: read

steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

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

- name: Setup Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: "v3.13.3"

- name: Lint API Helm Charts
if: always()
run: |
helm lint packages/api/chart --quiet

- name: Lint llama-cpp-python Helm Charts
if: always()
run: |
helm lint packages/llama-cpp-python/chart --quiet

- name: Lint text-embeddings Helm Charts
if: always()
run: |
helm lint packages/text-embeddings/chart --quiet

- name: Lint vllm Helm Charts
if: always()
run: |
helm lint packages/vllm/chart --quiet

- name: Lint whisper Helm Charts
if: always()
run: |
helm lint packages/whisper/chart --quiet

- name: Lint repeater Helm Charts
if: always()
run: |
helm lint packages/repeater/chart --quiet

- name: Lint UI Helm Charts
if: always()
run: |
helm lint packages/ui/chart --quiet

# TODO: we will not be linting or refactoring Supabase charts until GitHub issue #968 is resolved and a path forward is provided
48 changes: 48 additions & 0 deletions .github/workflows/uds-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: UDS Lint

on:
pull_request:
branches:
- "main"
paths:
- "bundles/**"
- ".github/workflows/uds-lint.yaml"

concurrency:
group: uds-lint-${{ github.ref }}
cancel-in-progress: true

jobs:
uds-lint:
runs-on: ubuntu-latest
name: Lint UDS Manifest

permissions:
contents: read

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

- name: Set up Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version-file: "pyproject.toml"

- name: Install jsonschema
run: pip install check-jsonschema==0.28.0

- name: Download UDS Bundle Schema
run: curl -o uds.schema.json https://raw.githubusercontent.com/defenseunicorns/uds-cli/v0.14.0/uds.schema.json

- name: Validate uds-bundle.yaml (dev)
if: always()
run: |
check-jsonschema bundles/dev/gpu/uds-bundle.yaml --schemafile uds.schema.json
check-jsonschema bundles/dev/cpu/uds-bundle.yaml --schemafile uds.schema.json

- name: Validate uds-bundle.yaml (latest)
if: always()
run: |
check-jsonschema bundles/latest/gpu/uds-bundle.yaml --schemafile uds.schema.json
check-jsonschema bundles/latest/cpu/uds-bundle.yaml --schemafile uds.schema.json
77 changes: 77 additions & 0 deletions .github/workflows/zarf-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Zarf Lint
justinthelaw marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
branches:
- "main"
paths:
- "**/zarf.yaml"
- ".github/workflows/zarf-lint.yaml"

concurrency:
group: zarf-lint-${{ github.ref }}
cancel-in-progress: true

jobs:
zarf-lint:
runs-on: ubuntu-latest
name: Lint Zarf Manifest

permissions:
contents: read

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

- name: Set up Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version-file: "pyproject.toml"

- name: Download Zarf Package Schema
# TODO: renovate setup
run: curl -o zarf.schema.json https://raw.githubusercontent.com/defenseunicorns/uds-cli/v0.14.0/zarf.schema.json

- name: Install jsonschema
run: pip install check-jsonschema==0.28.0

- name: Validate API zarf.yaml
if: always()
jalling97 marked this conversation as resolved.
Show resolved Hide resolved
run: |
check-jsonschema packages/api/zarf.yaml --schemafile zarf.schema.json

- name: Validate llama-cpp-python zarf.yaml
if: always()
run: |
check-jsonschema packages/llama-cpp-python/zarf.yaml --schemafile zarf.schema.json

- name: Validate repeater zarf.yaml
if: always()
run: |
check-jsonschema packages/repeater/zarf.yaml --schemafile zarf.schema.json

- name: Validate supabase zarf.yaml
if: always()
run: |
check-jsonschema packages/supabase/zarf.yaml --schemafile zarf.schema.json

- name: Validate text-embeddings zarf.yaml
if: always()
run: |
check-jsonschema packages/text-embeddings/zarf.yaml --schemafile zarf.schema.json

- name: Validate UI zarf.yaml
if: always()
run: |
check-jsonschema packages/ui/zarf.yaml --schemafile zarf.schema.json

- name: Validate vllm zarf.yaml
if: always()
run: |
check-jsonschema packages/vllm/zarf.yaml --schemafile zarf.schema.json

- name: Validate whisper zarf.yaml
if: always()
run: |
check-jsonschema packages/whisper/zarf.yaml --schemafile zarf.schema.json
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ src/leapfrogai_api/config.yaml
node_modules
package.json
package-lock.json
**/*.schema.json

# local model and tokenizer files
*.bin
Expand Down
13 changes: 13 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
failure-threshold: error
# TODO: slowly burn down these lower priority container warnings and errors, issue #984
ignored:
- DL3007 # use of latest image
- DL3042 # pip --no-cache-dir
- DL4006 # shell usage warning
- DL3009 # apt-get list
- DL3015 # --no-install-recommends
- DL3018 # pinning distro package versions
- DL3008 # pinning distro package versions
- DL3045 # usage of relative COPY
- DL3002 # last user as root
- SC2086 # double quote vs single quote usage
Loading
Loading