Skip to content

Commit 0219fe8

Browse files
committed
Fix release workflows
- Check for dirty repository in release - Fix helm release workflow name - Rename dist dir to manifests as dist is used by goreleaser
1 parent 64091a6 commit 0219fe8

File tree

5 files changed

+97
-21
lines changed

5 files changed

+97
-21
lines changed

.github/workflows/docker.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ jobs:
3939
with:
4040
fetch-depth: 0 # It is required for GoReleaser to work properly
4141

42+
- name: Install modules
43+
run: go mod tidy
44+
45+
- name: check git status
46+
run: git --no-pager diff --exit-code
4247
# Set up BuildKit Docker container builder to be able to build
4348
# multi-platform images and export cache
4449
# https://github.com/docker/setup-buildx-action

.github/workflows/helm.yml

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release Helm Chart and Carvel package
1+
name: Release Helm Chart
22

33
on:
44
push:
@@ -9,28 +9,58 @@ on:
99
- main
1010

1111
jobs:
12-
release:
12+
chart-release:
1313
runs-on: ubuntu-latest
14+
env:
15+
CHART_BASE_DIR: helm
16+
GH_PAGES_BRANCH: gh-pages
17+
permissions:
18+
contents: write
19+
pages: write
1420
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v3.1.0
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
1723
with:
1824
fetch-depth: 0
1925

20-
- name: Configure Git
26+
- name: Set ENVs
27+
id: env-setup
2128
run: |
29+
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
2230
git config user.name "$GITHUB_ACTOR"
2331
git config user.email "[email protected]"
2432
25-
- name: Install Helm
26-
uses: azure/[email protected]
27-
with:
28-
version: v3.4.2
33+
- name: Package Charts
34+
run: |
35+
# Package charts
36+
mkdir -p charts/.ci-build
37+
echo "Setting chart version to ${{ steps.env-setup.outputs.CHART_VERSION }}"
38+
39+
for DIR in $CHART_BASE_DIR/*; do
40+
# Check if Chart.yaml exists in this directory
41+
if [ -f "${DIR}/Chart.yaml" ]; then
42+
echo "Packaging ${DIR}"
43+
helm dependency update $DIR
44+
helm lint $DIR
45+
helm package $DIR --destination charts/.ci-build
46+
fi
47+
done
48+
git fetch --all
2949
30-
- name: Run chart-releaser
31-
uses: helm/[email protected]
50+
- name: Upload chart artifacts
51+
uses: actions/upload-artifact@v4
3252
with:
33-
charts_dir: helm
34-
env:
35-
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
36-
CR_RELEASE_NAME_TEMPLATE: "helm-v{{ .Version }}"
53+
name: helm-charts-${{ github.ref_name }}
54+
path: charts/.ci-build/*
55+
retention-days: 30
56+
57+
- name: Publish to GH-Pages
58+
id: ghpublish
59+
run: |
60+
git checkout $GH_PAGES_BRANCH --force
61+
helm repo index charts/.ci-build/ --merge index.yaml --url ${{ github.server_url }}/${{github.repository}}/releases/download/${{ github.ref_name }}
62+
cp charts/.ci-build/index.yaml index.yaml
63+
echo "New index:" && cat index.yaml
64+
git add index.yaml charts
65+
git commit -a -m "bot: update pages index for helm charts"
66+
git push origin $GH_PAGES_BRANCH

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
125125

126126
.PHONY: build-installer
127127
build-installer: manifests ## Generate a consolidated YAML with CRDs and deployment.
128-
mkdir -p dist
129-
$(HELM) template --include-crds netbird-operator helm/netbird-operator > dist/install.yaml
128+
mkdir -p manifests
129+
$(HELM) template --include-crds netbird-operator helm/netbird-operator > manifests/install.yaml
130130

131131
##@ Deployment
132132

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This operator enables easily provisioning NetBird access on kubernetes clusters,
1919

2020
```sh
2121
kubectl create namespace netbird
22-
kubectl apply -n netbird -f https://github.com/netbirdio/kubernetes-operator/releases/latest/dist/install.yaml
22+
kubectl apply -n netbird -f https://github.com/netbirdio/kubernetes-operator/releases/latest/manifests/install.yaml
2323
```
2424

2525
**Using the Helm Chart**
@@ -38,7 +38,7 @@ helm show values netbirdio/netbird-operator
3838
**Using install.yaml**
3939

4040
```sh
41-
kubectl delete -n netbird -f https://github.com/netbirdio/kubernetes-operator/releases/latest/dist/install.yaml
41+
kubectl delete -n netbird -f https://github.com/netbirdio/kubernetes-operator/releases/latest/manifests/install.yaml
4242
kubectl delete namespace netbird
4343
```
4444

dist/install.yaml renamed to manifests/install.yaml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,41 @@ spec:
7575
status:
7676
description: NBSetupKeyStatus defines the observed state of NBSetupKey.
7777
properties:
78-
ready:
79-
type: boolean
78+
conditions:
79+
items:
80+
description: NBSetupKeyCondition defines a condition in NBSetupKey
81+
status.
82+
properties:
83+
lastProbeTime:
84+
description: Last time we probed the condition.
85+
format: date-time
86+
type: string
87+
lastTransitionTime:
88+
description: Last time the condition transitioned from one status
89+
to another.
90+
format: date-time
91+
type: string
92+
message:
93+
description: Human-readable message indicating details about
94+
last transition.
95+
type: string
96+
reason:
97+
description: Unique, one-word, CamelCase reason for the condition's
98+
last transition.
99+
type: string
100+
status:
101+
description: |-
102+
Status is the status of the condition.
103+
Can be True, False, Unknown.
104+
type: string
105+
type:
106+
description: Type is the type of the condition.
107+
type: string
108+
required:
109+
- status
110+
- type
111+
type: object
112+
type: array
80113
type: object
81114
type: object
82115
served: true
@@ -132,6 +165,14 @@ rules:
132165
- get
133166
- patch
134167
- update
168+
- apiGroups:
169+
- ""
170+
resources:
171+
- pods
172+
verbs:
173+
- get
174+
- list
175+
- watch
135176
- apiGroups:
136177
- ""
137178
resources:

0 commit comments

Comments
 (0)