Skip to content

Commit 07859b5

Browse files
authored
Merge branch 'main' into main
2 parents b32da6f + 987937e commit 07859b5

36 files changed

+1884
-544
lines changed

.github/workflows/build-image.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ jobs:
1414
runs-on: ubuntu-24.04
1515
steps:
1616
- name: Set up Go 1.23
17-
uses: actions/setup-go@v3
17+
uses: actions/setup-go@be3c94b385c4f180051c996d336f57a34c397495 # v3.6.1
1818
with:
1919
go-version: '1.23'
2020

2121
- name: Checkout code
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
2323

2424
- name: Login to Quay.io
25-
uses: docker/login-action@v2
25+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
2626
with:
2727
registry: quay.io
2828
username: ${{ secrets.APP_QUAY_USERNAME }}
2929
password: ${{ secrets.APP_QUAY_TOKEN }}
3030

3131
- name: Build and push latest image
32-
run: make docker-build docker-push -e IMG=quay.io/llamastack/llama-stack-k8s-operator:latest
32+
run: make image-build image-push -e IMG=quay.io/llamastack/llama-stack-k8s-operator:latest

.github/workflows/code-coverage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout code
13-
uses: actions/checkout@v4
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414

1515
- name: Set up Go
16-
uses: actions/setup-go@v5
16+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1717
with:
1818
go-version: '1.21'
1919

2020
- name: Set up limgo
21-
uses: GoTestTools/[email protected]
21+
uses: GoTestTools/limgo-action@d4a725a46ab3bdbbf23186bbbe54b4ff4a35d5a7 # v1.0.2
2222
with:
2323
version: "v1.0.0"
2424
install-only: true
@@ -33,7 +33,7 @@ jobs:
3333
cat /tmp/covcheck.md >> $GITHUB_STEP_SUMMARY
3434
3535
- name: Upload test coverage results
36-
uses: actions/upload-artifact@v4
36+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3737
if: ${{ always() }}
3838
with:
3939
name: test-coverage-results
Lines changed: 269 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,276 @@
1-
21
name: Generate Release
32

43
on:
54
workflow_dispatch:
5+
inputs:
6+
operator_version:
7+
description: 'Operator version to release (e.g., "0.2.1")'
8+
required: true
9+
type: string
10+
llamastack_version:
11+
description: 'LlamaStack distribution version (e.g., "0.2.12")'
12+
required: true
13+
type: string
14+
15+
permissions:
16+
contents: write
17+
actions: write
18+
19+
env:
20+
GIT_USER_NAME: github-actions[bot]
21+
GIT_USER_EMAIL: github-actions[bot]@users.noreply.github.com
22+
GO_VERSION: '1.23'
623

724
jobs:
8-
placeholder:
9-
runs-on: ubuntu-latest
25+
generate-release:
26+
runs-on: ubuntu-24.04
27+
outputs:
28+
operator_version: ${{ steps.validate.outputs.operator_version }}
29+
llamastack_version: ${{ steps.validate.outputs.llamastack_version }}
30+
release_branch: ${{ steps.validate.outputs.release_branch }}
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
34+
with:
35+
fetch-depth: 0 # Need full history to check existing tags
36+
37+
- name: Validate inputs
38+
id: validate
39+
shell: bash
40+
run: |
41+
# Validate version formats and check for existing releases
42+
[[ "${{ github.event.inputs.operator_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Error: Invalid operator version format"; exit 1; }
43+
[[ "${{ github.event.inputs.llamastack_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Error: Invalid llamastack version format"; exit 1; }
44+
45+
# Check for existing tag idempotently
46+
if git tag -l | grep -q "^v${{ github.event.inputs.operator_version }}$"; then
47+
echo "Tag v${{ github.event.inputs.operator_version }} already exists - verifying consistency..."
48+
49+
# Get the commit SHA that the existing tag points to
50+
tag_sha=$(git rev-list -n 1 "v${{ github.event.inputs.operator_version }}")
51+
current_sha=$(git rev-parse HEAD)
52+
53+
if [ "$tag_sha" != "$current_sha" ]; then
54+
echo "Error: Tag v${{ github.event.inputs.operator_version }} exists but points to different commit ($tag_sha vs $current_sha)"
55+
exit 1
56+
fi
57+
58+
echo "✅ Tag v${{ github.event.inputs.operator_version }} already exists and points to current commit - release is idempotent"
59+
else
60+
echo "✅ Tag v${{ github.event.inputs.operator_version }} does not exist - proceeding with new release"
61+
fi
62+
63+
# Extract major.minor for branch name (e.g., "0.2.1" -> "0.2")
64+
major_minor=$(echo "${{ github.event.inputs.operator_version }}" | cut -d. -f1-2)
65+
66+
# Set outputs for later steps
67+
echo "operator_version=${{ github.event.inputs.operator_version }}" >> $GITHUB_OUTPUT
68+
echo "llamastack_version=${{ github.event.inputs.llamastack_version }}" >> $GITHUB_OUTPUT
69+
echo "release_branch=release-$major_minor" >> $GITHUB_OUTPUT
70+
71+
- name: Configure git
72+
shell: bash
73+
run: |
74+
git config user.name "${{ env.GIT_USER_NAME }}"
75+
git config user.email "${{ env.GIT_USER_EMAIL }}"
76+
77+
- name: Create or checkout release branch
78+
shell: bash
79+
run: |
80+
release_branch="${{ steps.validate.outputs.release_branch }}"
81+
82+
# Check if release branch exists remotely
83+
if git ls-remote --heads origin | grep -q "refs/heads/$release_branch"; then
84+
echo "Checking out existing release branch: $release_branch"
85+
git fetch origin "$release_branch"
86+
git checkout "$release_branch"
87+
git pull origin "$release_branch"
88+
else
89+
echo "Creating new release branch: $release_branch"
90+
git checkout -b "$release_branch"
91+
fi
92+
93+
- name: Set up Go
94+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
95+
with:
96+
go-version: ${{ env.GO_VERSION }}
97+
98+
- name: Prepare release files
99+
shell: bash
100+
run: |
101+
# Use the make release command to update all necessary files
102+
make release VERSION=${{ steps.validate.outputs.operator_version }} LLAMASTACK_VERSION=${{ steps.validate.outputs.llamastack_version }}
103+
104+
- name: Set up Python
105+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
106+
with:
107+
python-version: '3.12'
108+
109+
- name: Run pre-commit checks
110+
uses: pre-commit/action@a26af69be951a213d495a4c3e4e4022e16d87065
111+
continue-on-error: true
112+
id: precommit
113+
env:
114+
IMG: quay.io/llamastack/llama-stack-k8s-operator:v${{ steps.validate.outputs.operator_version }}
115+
116+
- name: Handle pre-commit changes
117+
shell: bash
118+
env:
119+
IMG: quay.io/llamastack/llama-stack-k8s-operator:v${{ steps.validate.outputs.operator_version }}
120+
run: |
121+
# Check if there are any modified files after pre-commit
122+
if [ "${{ steps.precommit.outcome }}" = "failure" ]; then
123+
echo "📝 Pre-commit checks failed - checking for file modifications"
124+
125+
# Show what files exist and their status
126+
echo "Git status before staging:"
127+
git status --porcelain
128+
129+
git add .
130+
131+
echo "Git status after staging:"
132+
git status --porcelain
133+
134+
# Check if there are staged changes
135+
if git diff --staged --quiet; then
136+
echo "⚠️ No staged changes detected, but pre-commit failed"
137+
echo "This suggests pre-commit failed due to issues that weren't auto-fixable"
138+
echo "❌ Pre-commit checks failed without auto-fixes"
139+
exit 1
140+
else
141+
echo "📝 Staged changes detected - committing them"
142+
git commit -s -m "Apply pre-commit fixes for release ${{ steps.validate.outputs.operator_version }}" \
143+
-m "- Auto-format and regenerate release manifests" \
144+
-m "- Ensure consistency after release preparation"
145+
git push origin "${{ steps.validate.outputs.release_branch }}"
146+
147+
# Re-run pre-commit to ensure all checks pass
148+
echo "🔄 Re-running pre-commit to verify all checks pass"
149+
pre-commit run --show-diff-on-failure --color=always --all-files
150+
echo "✅ Pre-commit checks passed after applying fixes"
151+
fi
152+
else
153+
echo "✅ Pre-commit checks passed"
154+
fi
155+
156+
- name: Run unit and integration tests
157+
shell: bash
158+
run: |
159+
make test
160+
161+
- name: Validate build release image
162+
shell: bash
163+
run: |
164+
make image-build IMG=quay.io/llamastack/llama-stack-k8s-operator:v${{ steps.validate.outputs.operator_version }}
165+
166+
- name: Commit and push changes
167+
shell: bash
168+
run: |
169+
git add .
170+
if git diff --staged --quiet; then
171+
echo "No changes to commit - release files are already up to date"
172+
else
173+
git commit -s -m "v${{ steps.validate.outputs.operator_version }}" \
174+
-m "- Update operator version to v${{ steps.validate.outputs.operator_version }}" \
175+
-m "- Update LlamaStack distributions to ${{ steps.validate.outputs.llamastack_version }}" \
176+
-m "- Generate release manifests"
177+
git push origin "${{ steps.validate.outputs.release_branch }}"
178+
echo "✅ Committed release changes to ${{ steps.validate.outputs.release_branch }}"
179+
fi
180+
181+
finalize-release:
182+
needs: generate-release
183+
runs-on: ubuntu-24.04
184+
env:
185+
operator_version: ${{ needs.generate-release.outputs.operator_version }}
186+
llamastack_version: ${{ needs.generate-release.outputs.llamastack_version }}
187+
release_branch: ${{ needs.generate-release.outputs.release_branch }}
10188
steps:
11-
- run: echo "This is a placeholder job to make the workflow discoverable by the GitHub API."
189+
- name: Checkout code
190+
uses: actions/checkout@a26af69be951a213d495a4c3e4e4022e16d87065
191+
with:
192+
ref: ${{ env.release_branch }}
193+
fetch-depth: 0
194+
195+
- name: Configure git
196+
shell: bash
197+
run: |
198+
git config user.name "${{ env.GIT_USER_NAME }}"
199+
git config user.email "${{ env.GIT_USER_EMAIL }}"
200+
201+
- name: Create and push the release tag
202+
shell: bash
203+
run: |
204+
if git tag -l | grep -q "^v${{ env.operator_version }}$"; then
205+
echo "✅ Tag v${{ env.operator_version }} already exists - skipping creation"
206+
else
207+
git tag -a "v${{ env.operator_version }}" -m "Release v${{ env.operator_version }}"
208+
git push origin "v${{ env.operator_version }}"
209+
echo "✅ Created tag v${{ env.operator_version }}"
210+
fi
211+
212+
- name: Create GitHub Release
213+
shell: bash
214+
run: |
215+
if gh release view "v${{ env.operator_version }}" >/dev/null 2>&1; then
216+
echo "✅ GitHub release v${{ env.operator_version }} already exists - skipping creation"
217+
else
218+
RELEASE_NOTES="## What's Changed
219+
220+
- Updated operator version to v${{ env.operator_version }}
221+
- Updated LlamaStack distributions to ${{ env.llamastack_version }}
222+
- Generated updated release manifests
223+
224+
## Installation
225+
226+
Install the operator using kubectl:
227+
228+
\`\`\`bash
229+
kubectl apply -f https://raw.githubusercontent.com/llamastack/llama-stack-k8s-operator/v${{ env.operator_version }}/release/operator.yaml
230+
\`\`\`
231+
232+
## Container Images
233+
234+
- Operator: \`quay.io/llamastack/llama-stack-k8s-operator:v${{ env.operator_version }}\`
235+
- LlamaStack distributions: \`docker.io/llamastack/distribution-*:${{ env.llamastack_version }}\`"
236+
237+
gh release create "v${{ env.operator_version }}" \
238+
--title "v${{ env.operator_version }}" \
239+
--notes "$RELEASE_NOTES"
240+
241+
echo "🎉 Created GitHub release v${{ env.operator_version }}"
242+
fi
243+
env:
244+
GH_TOKEN: ${{ github.token }}
245+
246+
- name: Set up Go
247+
uses: actions/setup-go@a26af69be951a213d495a4c3e4e4022e16d87065
248+
with:
249+
go-version: ${{ env.GO_VERSION }}
250+
251+
- name: Build release image
252+
shell: bash
253+
run: |
254+
make image-build IMG=quay.io/llamastack/llama-stack-k8s-operator:v${{ env.operator_version }}
255+
256+
- name: Log in to Quay.io
257+
uses: docker/login-action@a26af69be951a213d495a4c3e4e4022e16d87065
258+
with:
259+
registry: quay.io
260+
username: ${{ secrets.APP_QUAY_USERNAME }}
261+
password: ${{ secrets.APP_QUAY_TOKEN }}
262+
263+
- name: Push release image
264+
shell: bash
265+
run: |
266+
make image-push IMG=quay.io/llamastack/llama-stack-k8s-operator:v${{ env.operator_version }}
267+
echo "✅ Pushed: quay.io/llamastack/llama-stack-k8s-operator:v${{ env.operator_version }}"
268+
269+
- name: Release complete
270+
shell: bash
271+
run: |
272+
echo "🚀 Release v${{ env.operator_version }} completed successfully!"
273+
echo "📦 Container image: quay.io/llamastack/llama-stack-k8s-operator:v${{ env.operator_version }}"
274+
echo "📝 Release notes: https://github.com/${{ github.repository }}/releases/tag/v${{ env.operator_version }}"
275+
echo "🔧 Install with: kubectl apply -f https://raw.githubusercontent.com/llamastack/llama-stack-k8s-operator/v${{ env.operator_version }}/release/operator.yaml"
276+
echo "🌿 Release branch: ${{ env.release_branch }}"

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919

2020
- name: Set up Go env
21-
uses: actions/setup-go@v5
21+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
2222
with:
2323
go-version-file: go.mod
2424

.github/workflows/release-image.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ jobs:
2121
runs-on: ubuntu-24.04
2222
steps:
2323
- name: Set up Go 1.23
24-
uses: actions/setup-go@v3
24+
uses: actions/setup-go@be3c94b385c4f180051c996d336f57a34c397495 # v3.6.1
2525
with:
2626
go-version: '1.23'
2727

2828
- name: Checkout code
29-
uses: actions/checkout@v3
29+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
3030
with:
3131
ref: ${{ github.event.inputs.release_branch }}
3232

3333
- name: Login to Quay.io
34-
uses: docker/login-action@v2
34+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
3535
with:
3636
registry: quay.io
3737
username: ${{ secrets.APP_QUAY_USERNAME }}

.github/workflows/run-e2e-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout code
13-
uses: actions/checkout@v4
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414

1515
- name: Set up Go
16-
uses: actions/setup-go@v5
16+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1717
with:
1818
go-version: '1.21'
1919

2020
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v3
21+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
2222

2323
- name: Create kind config
2424
run: |
@@ -49,7 +49,7 @@ jobs:
4949
5050
- name: Create k8s Kind Cluster
5151
id: kind
52-
uses: helm/kind-action@v1
52+
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
5353
with:
5454
registry: true
5555
registry_name: kind-registry

0 commit comments

Comments
 (0)