Skip to content

Commit 203c786

Browse files
committed
operator: add ci for build and check-bundle
1 parent f34355e commit 203c786

File tree

4 files changed

+102
-1
lines changed

4 files changed

+102
-1
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
- image_name: jumpstarter-dev/jumpstarter-operator
2727
dockerfile: Dockerfile.operator
2828
context: .
29+
- image_name: jumpstarter-dev/jumpstarter-operator-bundle
30+
dockerfile: bundle.Dockerfile
31+
context: deploy/operator
2932
steps:
3033
- name: Checkout repository
3134
uses: actions/checkout@v4
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Check Bundle
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- 'release-*'
7+
8+
jobs:
9+
check-bundle:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version: 1.24
21+
22+
- name: Cache bin directory (deploy/operator)
23+
uses: actions/cache@v4
24+
with:
25+
path: deploy/operator/bin/
26+
key: ${{ runner.os }}-operator-bin-${{ hashFiles('deploy/operator/go.mod') }}
27+
restore-keys: |
28+
${{ runner.os }}-operator-bin-
29+
30+
- name: Get version
31+
run: |
32+
if [ "${{ github.event_name }}" == "pull_request" ]; then
33+
BASE_BRANCH="${{ github.base_ref }}"
34+
if [ "$BASE_BRANCH" == "main" ]; then
35+
TAG="latest"
36+
elif [[ "$BASE_BRANCH" =~ ^release- ]]; then
37+
TAG="$BASE_BRANCH"
38+
else
39+
echo "::error::Unknown base branch: $BASE_BRANCH"
40+
exit 1
41+
fi
42+
else
43+
echo "::error::Unsupported event: ${{ github.event_name }}"
44+
exit 1
45+
fi
46+
echo "TAG=${TAG}" >> $GITHUB_ENV
47+
echo "TAG=${TAG}"
48+
49+
- name: Run make bundle
50+
working-directory: deploy/operator
51+
run: |
52+
make bundle IMG="quay.io/jumpstarter-dev/jumpstarter-operator:${TAG}"
53+
54+
- name: Check for uncommitted changes
55+
run: |
56+
DIFF=$(git diff)
57+
if [ -n "$DIFF" ]; then
58+
# Filter out createdAt timestamp lines and context lines, check if any actual changes remain
59+
FILTERED_DIFF=$(echo "$DIFF" | grep -vE '^(---|\+\+\+|@@|index|diff)' | grep -vE '^[+-].*createdAt:.*[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z' || true)
60+
# Check if there are any non-timestamp, non-context changes
61+
if [ -n "$FILTERED_DIFF" ] && [ -n "$(echo "$FILTERED_DIFF" | grep -E '^[+-]' || true)" ]; then
62+
echo "::error::Uncommitted changes detected after running 'make bundle'. Please commit all bundle changes before pushing."
63+
echo "::error::This can be done by running 'make bundle IMG=\"quay.io/jumpstarter-dev/jumpstarter-operator:${TAG}\""
64+
git diff
65+
exit 1
66+
else
67+
echo "Only timestamp changes detected (ignored). Bundle files are up to date."
68+
# Reset the timestamp changes to keep the repo clean
69+
git checkout -- .
70+
fi
71+
else
72+
echo "No uncommitted changes detected. Bundle files are up to date."
73+
fi
74+
75+
- name: Ensure clean state before build-installer
76+
run: |
77+
# Reset any remaining changes from root
78+
git checkout -- . || true
79+
80+
- name: Run make build-installer
81+
working-directory: deploy/operator
82+
run: |
83+
make build-installer
84+
85+
- name: Check for uncommitted changes after build-installer
86+
run: |
87+
if [ -n "$(git diff)" ]; then
88+
echo "::error::Uncommitted changes detected after running 'make build-installer'. Please commit all installer changes before pushing."
89+
echo "::error::This can be done by running 'make build-installer'"
90+
git diff
91+
exit 1
92+
else
93+
echo "No uncommitted changes detected. Installer files are up to date."
94+
fi
95+

deploy/operator/bundle/manifests/jumpstarter-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ kind: ClusterRole
33
metadata:
44
creationTimestamp: null
55
name: jumpstarter-operator-metrics-reader
6+
labels:
7+
app.kubernetes.io/managed-by: kustomize
8+
app.kubernetes.io/name: jumpstarter-operator
69
rules:
710
- nonResourceURLs:
811
- /metrics

deploy/operator/bundle/manifests/jumpstarter-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ spec:
383383
- framework
384384
links:
385385
- name: Jumpstarter Operator
386-
url: https://jumpstarter-operator.domain
386+
url: https://jumpstarter.dev/main/getting-started/installation/service/index.html
387387
maintainers:
388388
389389
name: Miguel Angel Ajo

0 commit comments

Comments
 (0)