Skip to content

Commit d60a800

Browse files
committed
run go-makefile-maker, use new ghcr helm push workflow, remove kustomize
1 parent 913cfdb commit d60a800

6 files changed

Lines changed: 74 additions & 122 deletions

File tree

.github/workflows/checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
version: latest
3737
- name: Delete pre-installed shellcheck
38-
run: sudo rm -f $(which shellcheck)
38+
run: sudo rm -f "$(which shellcheck)"
3939
- name: Run shellcheck
4040
run: make run-shellcheck
4141
- name: Dependency Licenses Review
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
################################################################################
2+
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
3+
# Edit Makefile.maker.yaml instead. #
4+
################################################################################
5+
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
7+
# SPDX-License-Identifier: Apache-2.0
8+
9+
name: Helm OCI Package GHCR
10+
"on":
11+
push:
12+
branches:
13+
- main
14+
tags:
15+
- '*'
16+
workflow_dispatch: {}
17+
permissions:
18+
contents: read
19+
packages: write
20+
jobs:
21+
build-and-push-helm-package:
22+
name: Build and publish Helm Chart OCI
23+
runs-on: large_runner_16core_64gb
24+
steps:
25+
- name: Check out code
26+
uses: actions/checkout@v6
27+
with:
28+
fetch-depth: 0
29+
fetch-tags: true
30+
- name: Install Helm
31+
uses: azure/setup-helm@v4
32+
- name: Lint Helm Chart
33+
run: helm lint charts/kvm-node-agent
34+
- name: Package Helm Chart
35+
run: |
36+
# try to detect a version from the git tags, set APP_VERSION only if this commit has been tagged
37+
APP_VERSION=$(git describe --tags --exact-match ${{ github.sha }} 2>/dev/null || echo "")
38+
if [ -n "$APP_VERSION" ]; then
39+
VERSION=$(echo -n "$APP_VERSION" | sed -E 's/^v//')
40+
else
41+
VERSION=$((git describe --tags --abbrev=0 2>/dev/null | sed -E 's/^v//') || echo "")
42+
fi
43+
44+
# use the git sha as app-version, if no version could be detected from the tags
45+
if [ -z "$APP_VERSION" ]; then
46+
APP_VERSION=$(echo -n "sha-${{ github.sha }}")
47+
fi
48+
# use the git sha as helm version suffix, version is semver
49+
if [ -z "$VERSION" ] && [ -n "$APP_VERSION" ]; then
50+
VERSION="$(helm show chart charts/kvm-node-agent | grep -E "^version:" | awk '{print $2}' )+${APP_VERSION:0:11}"
51+
fi
52+
53+
HELM_ARGS=--dependency-update
54+
if [ -n "$APP_VERSION" ]; then
55+
HELM_ARGS="$HELM_ARGS --app-version $APP_VERSION"
56+
fi
57+
if [ -n "$VERSION" ]; then
58+
HELM_ARGS="$HELM_ARGS --version $VERSION"
59+
fi
60+
echo "Running helm package with $HELM_ARGS"
61+
helm package charts/kvm-node-agent --destination ./chart $HELM_ARGS
62+
- name: Log in to the Container registry
63+
uses: docker/login-action@v4
64+
with:
65+
password: ${{ secrets.GITHUB_TOKEN }}
66+
registry: ghcr.io
67+
username: ${{ github.actor }}
68+
- name: Push Helm Chart to ghcr.io
69+
run: helm push ./chart/*.tgz oci://ghcr.io/${{ github.repository_owner }}/charts

.github/workflows/publish-helm.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ FORCE:
4343

4444
.PHONY: install-crds
4545
install-crds: generate ## Install CRDs into the K8s cluster specified in ~/.kube/config.
46-
kubectl kustomize config/crd | kubectl apply -f -
47-
48-
.PHONY: helmify
49-
helmify:
50-
kubectl kustomize config/default | helmify -crd-dir charts/kvm-node-agent
46+
kubectl apply -f charts/kvm-node-agent/crds/kvm.cloud.sap_*.yaml
5147

5248
install-goimports: FORCE
5349
@if ! hash goimports 2>/dev/null; then printf "\e[1;36m>> Installing goimports (this may take a while)...\e[0m\n"; go install golang.org/x/tools/cmd/goimports@latest; fi

Makefile.maker.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ githubWorkflow:
4545
- semver
4646
- edge
4747
- sha
48+
pushHelmChartToGhcr:
49+
path: charts/kvm-node-agent
4850
license:
4951
enabled: true
5052

@@ -81,4 +83,4 @@ verbatim: |
8183
8284
.PHONY: install-crds
8385
install-crds: generate ## Install CRDs into the K8s cluster specified in ~/.kube/config.
84-
kubectl apply -f config/crd/*.yaml
86+
kubectl apply -f charts/kvm-node-agent/crds/kvm.cloud.sap_*.yaml

config/rbac/role.yaml

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)