Skip to content

Commit 725993c

Browse files
authored
Merge pull request #51 from SUSE/feat/suse-ai-operator
feat: SUSE AI Operator
2 parents 55f6341 + d131510 commit 725993c

63 files changed

Lines changed: 5295 additions & 9 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Publish Extension Container and Helm Chart
1+
name: Build and Publish Extension [Container and Helm Chart]
22

33
on: [push, pull_request, workflow_dispatch]
44

@@ -59,7 +59,7 @@ jobs:
5959
run: yarn
6060

6161
- name: Parse Extension Name
62-
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
62+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
6363
id: parsed-name
6464
env:
6565
GH_TOKEN: ${{ github.token }}
@@ -68,7 +68,7 @@ jobs:
6868
yarn parse-tag-name ${{ env.RELEASE_TAG }} ${{ github.run_id }} "catalog"
6969
7070
- name: Build and push UI image
71-
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
71+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
7272
env:
7373
RELEASE_TAG: ${{ steps.tags.outputs.TAGS }}
7474
run: |
@@ -81,18 +81,18 @@ jobs:
8181
"${publish[@]}"
8282
8383
- name: Re-checkout repository
84-
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
84+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
8585
uses: actions/checkout@v4
8686

8787
- name: Package Helm Chart
88-
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
88+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
8989
id: package
9090
run: |
9191
chart_package=$(helm package $CHART_PATH --destination . | awk '{print $NF}')
9292
echo "chart_package=$chart_package" >> $GITHUB_OUTPUT
9393
9494
- name: Publish Helm Chart
95-
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
95+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
9696
run: |
9797
helm push ${{ steps.package.outputs.chart_package }} \
9898
$CHART_REGISTRY
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
name: Release SUSE AI Operator [Container and Helm Chart]
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- suse-ai-operator-*
9+
10+
env:
11+
CONTAINER_REGISTRY: ghcr.io/leooamaral/suse-ai-operator
12+
CHART_PATH: deploy/charts/suse-ai-operator
13+
CHART_REGISTRY: oci://ghcr.io/leooamaral/chart
14+
jobs:
15+
container:
16+
outputs:
17+
VERSION: ${{ steps.tags.outputs.VERSION }}
18+
CHART_VERSION: ${{ steps.tags.outputs.CHART_VERSION }}
19+
PUBLISH: ${{ steps.tags.outputs.PUBLISH }}
20+
METADATA_TAGS: ${{ steps.tags.outputs.METADATA_TAGS }}
21+
NOTES_START_TAG: ${{ steps.tags.outputs.NOTES_START_TAG }}
22+
permissions:
23+
contents: read
24+
packages: write
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Calculate tags
31+
id: tags
32+
shell: bash
33+
run: |
34+
ref=${{ github.ref }}
35+
case "$ref" in
36+
refs/heads/main)
37+
BASE_VERSION=$(cat VERSION)
38+
39+
git fetch --tags
40+
41+
LAST_DEV=$(git tag \
42+
--list "suse-ai-operator-${BASE_VERSION}-dev.*" \
43+
--sort=-v:refname \
44+
| head -n 1)
45+
46+
if [[ -z "$LAST_DEV" ]]; then
47+
DEV_NUM=1
48+
NOTES_START_TAG=$(git tag --list "suse-ai-operator-*" --sort=-v:refname | grep -v "\-dev" | head -n 1)
49+
else
50+
DEV_NUM="${LAST_DEV##*.}"
51+
DEV_NUM=$((DEV_NUM + 1))
52+
NOTES_START_TAG="$LAST_DEV"
53+
fi
54+
55+
VERSION="${BASE_VERSION}-dev.${DEV_NUM}"
56+
IMAGE_TAGS="$VERSION"
57+
CHART_VERSION="$VERSION"
58+
59+
{
60+
echo "METADATA_TAGS<<EOF"
61+
echo "$VERSION"
62+
echo "EOF"
63+
} >> "$GITHUB_OUTPUT"
64+
65+
PUBLISH=true
66+
;;
67+
refs/tags/suse-ai-operator-*)
68+
VERSION="${ref#refs/tags/suse-ai-operator-}"
69+
IMAGE_TAGS="$VERSION"
70+
CHART_VERSION="$VERSION"
71+
NOTES_START_TAG=""
72+
73+
{
74+
echo "METADATA_TAGS<<EOF"
75+
echo "$VERSION"
76+
if [[ "$VERSION" != *"-"* ]]; then
77+
echo "latest"
78+
fi
79+
echo "EOF"
80+
} >> "$GITHUB_OUTPUT"
81+
82+
PUBLISH=true
83+
;;
84+
*)
85+
VERSION="${{ github.sha }}"
86+
IMAGE_TAGS="$VERSION"
87+
CHART_VERSION="$VERSION"
88+
NOTES_START_TAG=""
89+
90+
{
91+
echo "METADATA_TAGS<<EOF"
92+
echo "$VERSION"
93+
echo "EOF"
94+
} >> "$GITHUB_OUTPUT"
95+
96+
PUBLISH=false
97+
;;
98+
esac
99+
100+
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
101+
echo "IMAGE_TAGS=$IMAGE_TAGS" >> "$GITHUB_OUTPUT"
102+
echo "PUBLISH=$PUBLISH" >> "$GITHUB_OUTPUT"
103+
echo "CHART_VERSION=$CHART_VERSION" >> "$GITHUB_OUTPUT"
104+
echo "NOTES_START_TAG=$NOTES_START_TAG" >> "$GITHUB_OUTPUT"
105+
106+
- name: Login to GHCR
107+
if: steps.tags.outputs.PUBLISH == 'true'
108+
uses: docker/login-action@v3
109+
with:
110+
registry: ghcr.io
111+
username: ${{ github.repository_owner }}
112+
password: ${{ secrets.GITHUB_TOKEN }}
113+
114+
- name: Set up QEMU
115+
if: steps.tags.outputs.PUBLISH == 'true'
116+
uses: docker/setup-qemu-action@v3
117+
118+
- name: Setup Docker Buildx
119+
if: steps.tags.outputs.PUBLISH == 'true'
120+
uses: docker/setup-buildx-action@v3
121+
122+
- name: Get Docker Metadata
123+
id: meta
124+
if: steps.tags.outputs.PUBLISH == 'true'
125+
uses: docker/metadata-action@v5
126+
with:
127+
images: ${{ env.CONTAINER_REGISTRY }}
128+
tags: |
129+
${{ steps.tags.outputs.METADATA_TAGS }}
130+
131+
- name: Build Docker Container
132+
id: push
133+
if: steps.tags.outputs.PUBLISH == 'true'
134+
uses: docker/build-push-action@v6
135+
with:
136+
context: .
137+
labels: ${{ steps.meta.outputs.labels }}
138+
tags: ${{ steps.meta.outputs.tags }}
139+
push: true
140+
platforms: linux/arm64,linux/amd64
141+
142+
helm:
143+
needs: container
144+
if: needs.container.outputs.PUBLISH == 'true'
145+
permissions:
146+
contents: write
147+
packages: write
148+
runs-on: ubuntu-latest
149+
steps:
150+
- name: Checkout
151+
uses: actions/checkout@v4
152+
with:
153+
fetch-depth: 0
154+
155+
- name: Login to GHCR
156+
uses: docker/login-action@v3
157+
with:
158+
registry: ghcr.io
159+
username: ${{ github.repository_owner }}
160+
password: ${{ secrets.GITHUB_TOKEN }}
161+
162+
- name: Update Chart.yaml
163+
run: |
164+
yq -i '.version = "${{ needs.container.outputs.CHART_VERSION }}"' $CHART_PATH/Chart.yaml
165+
yq -i '.appVersion = "${{ needs.container.outputs.VERSION }}"' $CHART_PATH/Chart.yaml
166+
167+
- name: Update image annotations
168+
run: |
169+
yq -i '
170+
.annotations."helm.sh/images" =
171+
"- image: ghcr.io/leooamaral/suse-ai-operator:${{ needs.container.outputs.VERSION }}\n name: suse-ai-operator"
172+
' $CHART_PATH/Chart.yaml
173+
174+
- name: Package Helm Chart
175+
id: package
176+
run: |
177+
chart_package=$(helm package $CHART_PATH --destination . | awk '{print $NF}')
178+
echo "chart_package=$chart_package" >> $GITHUB_OUTPUT
179+
180+
- name: Publish Helm Chart
181+
run: |
182+
helm push ${{ steps.package.outputs.chart_package }} \
183+
$CHART_REGISTRY
184+
185+
- name: Create dev git tag
186+
if: needs.container.outputs.PUBLISH == 'true' && github.ref == 'refs/heads/main'
187+
run: |
188+
git config user.name "github-actions"
189+
git config user.email "github-actions@github.com"
190+
191+
TAG="suse-ai-operator-${{ needs.container.outputs.VERSION }}"
192+
git checkout -b release/${TAG}
193+
194+
git add $CHART_PATH/Chart.yaml
195+
git commit -m "chore(release): ${TAG}"
196+
197+
git tag "$TAG"
198+
git push origin "$TAG"
199+
200+
- name: Create pre-release and release notes for dev
201+
env:
202+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
203+
START_TAG: ${{ needs.container.outputs.NOTES_START_TAG }}
204+
if: needs.container.outputs.PUBLISH == 'true' && github.ref == 'refs/heads/main'
205+
run: |
206+
TAG="suse-ai-operator-${{ needs.container.outputs.VERSION }}"
207+
208+
NOTES_ARG=""
209+
if [[ -n "$START_TAG" ]]; then
210+
NOTES_ARG="--notes-start-tag $START_TAG"
211+
fi
212+
213+
gh release create "${TAG}" \
214+
--title "${TAG}" \
215+
--prerelease --fail-on-no-commits \
216+
--generate-notes $NOTES_ARG

charts/suse-ai-lifecycle-manager/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SUSE AI Rancher UI Extension
1+
# SUSE AI Lifecycle Manager
22

33
This chart installs the **Rancher Extension Catalog**, it contains extension assets bundled into an image and act as a catalog for custom extensions.
44
1. This Chart is installed.
@@ -81,11 +81,11 @@ The command removes all the Kubernetes components associated with the chart and
8181
### Check pod status
8282

8383
```bash
84-
kubectl get pods -l app.kubernetes.io/name=suse-ai-lifecycle-manager
84+
kubectl get pods -l app.kubernetes.io/name=suse-ai-lifecycle-manager -n cattle-ui-plugin-system
8585
```
8686

8787
### Check logs
8888

8989
```bash
90-
kubectl logs -l app.kubernetes.io/name=suse-ai-lifecycle-manager
90+
kubectl logs -l app.kubernetes.io/name=suse-ai-lifecycle-manager -n cattle-ui-plugin-system
9191
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Patterns to ignore when building Helm packages.
2+
# Operating system files
3+
.DS_Store
4+
5+
# Version control directories
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.hg/
10+
.hgignore
11+
.svn/
12+
13+
# Backup and temporary files
14+
*.swp
15+
*.tmp
16+
*.bak
17+
*.orig
18+
*~
19+
20+
# IDE and editor-related files
21+
.idea/
22+
.vscode/
23+
24+
# Helm chart artifacts
25+
dist/chart/*.tgz
26+
chart/*.tgz
27+
chart/*/*.tgz

charts/suse-ai-operator/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
annotations:
2+
helm.sh/images: |
3+
- image: ghcr.io/suse/suse-ai-operator:0.1.0
4+
name: suse-ai-operator
5+
license: Apache-2.0
6+
apiVersion: v2
7+
name: suse-ai-operator
8+
version: 0.1.0
9+
description: SUSE AI Operator
10+
type: application
11+
home: https://github.com/SUSE/suse-ai-operator
12+
icon: https://github.com/SUSE/suse-ai-lifecycle-manager/blob/main/pkg/suse-ai-lifecycle-manager/assets/logo.svg
13+
sources:
14+
- https://github.com/SUSE/suse-ai-operator
15+
appVersion: 0.1.0
16+
maintainers:
17+
- url: https://www.suse.com/
18+
name: SUSE LLC
19+
keywords:
20+
- rancher
21+
- extension
22+
- ai
23+
- kubernetes
24+
- operator

0 commit comments

Comments
 (0)