Skip to content

Commit d31fff2

Browse files
committed
feat(ci): attach release manifests for clusterctl
1 parent d959819 commit d31fff2

File tree

7 files changed

+98
-52
lines changed

7 files changed

+98
-52
lines changed

.github/workflows/release-drafter.yaml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,42 @@ on:
55
push:
66
branches:
77
- main
8+
permissions:
9+
contents: write
810

911
jobs:
1012
build:
1113
runs-on: ubuntu-latest
1214
steps:
13-
- uses: release-drafter/release-drafter@v6
14-
env:
15-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
- uses: release-drafter/release-drafter@v6
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: "1.21"
28+
29+
- name: install kustomize
30+
run: |
31+
make kustomize
32+
- name: generate release artifacts
33+
env:
34+
IMG_TAG: ${{ github.ref_name }}
35+
RELEASE_DIR: .release
36+
run: |
37+
make release-manifests
38+
39+
- name: Attach release manifests
40+
uses: softprops/action-gh-release@v2
41+
if: startsWith(github.ref, 'refs/tags/')
42+
with:
43+
name: v${{ RESOLVED_VERSION }}
44+
draft: true
45+
fail_on_unmatched_files: true
46+
files: .release/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
bin/*
88
test/external-crds
99
Dockerfile.cross
10+
.release
1011

1112
infrastructure-components.yaml
1213
.capms-cluster-kubeconfig.yaml

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Image URL to use all building/pushing image targets
2-
IMG ?= capms-controller:latest
2+
IMG ?= ghcr.io/metal-stack/capms-controller:latest
3+
IMG_NAME ?= ghcr.io/metal-stack/capms-controller
4+
IMG_TAG ?= latest
35
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
46
ENVTEST_K8S_VERSION = 1.31.0
7+
RELEASE_DIR ?= .release
58

69
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
710
ifeq (,$(shell go env GOBIN))
@@ -45,8 +48,9 @@ help: ## Display this help.
4548

4649
.PHONY: release-manifests
4750
release-manifests: $(KUSTOMIZE) ## Builds the manifests to publish with a release
48-
$(KUSTOMIZE) build config/default > infrastructure-components.yaml
49-
# cp metadata.yaml $(RELEASE_DIR)/metadata.yaml
51+
$(KUSTOMIZE) build config/default > $(RELEASE_DIR)/infrastructure-components.yaml
52+
sed -i 's!image: $(IMG_NAME):latest!image: $(IMG_NAME):$(IMG_TAG)!' $(RELEASE_DIR)/infrastructure-components.yaml
53+
cp metadata.yaml $(RELEASE_DIR)/metadata.yaml
5054
# cp examples/clusterctl-templates/clusterctl-cluster.yaml $(RELEASE_DIR)/cluster-template.yaml
5155
# cp examples/clusterctl-templates/example_variables.rc $(RELEASE_DIR)/example_variables.rc
5256

@@ -55,7 +59,7 @@ release-manifests: $(KUSTOMIZE) ## Builds the manifests to publish with a releas
5559
.PHONY: push-to-capi-lab
5660
push-to-capi-lab: generate manifests build install deploy
5761
docker build -t $(IMG) -f Dockerfile.dev .
58-
kind --name metal-control-plane load docker-image capms-controller:latest
62+
kind --name metal-control-plane load docker-image $(IMG)
5963
kubectl --kubeconfig=$(KUBECONFIG) patch deployments.apps -n capms-system capms-controller-manager --patch='{"spec":{"template":{"spec":{"containers":[{"name": "manager","imagePullPolicy":"IfNotPresent","image":"$(IMG)"}]}}}}'
6064
kubectl --kubeconfig=$(KUBECONFIG) delete pod -n capms-system -l control-plane=controller-manager
6165

capi-lab/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DEFAULT_GOAL := up
22

33
KUBECONFIG := $(shell pwd)/mini-lab/.kubeconfig
4-
IMG ?= capms-controller:latest
4+
IMG ?= ghcr.io/metal-stack/capms-controller:latest
55

66
.PHONY: up
77
up: bake deploy-capi

config/manager/manager.yaml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -33,48 +33,48 @@ spec:
3333
seccompProfile:
3434
type: RuntimeDefault
3535
containers:
36-
- env:
37-
- name: METAL_API_URL
38-
valueFrom:
39-
secretKeyRef:
40-
name: controller-manager-config
41-
key: api-url
42-
- name: METAL_API_HMAC
43-
valueFrom:
44-
secretKeyRef:
45-
name: controller-manager-config
46-
key: api-hmac
47-
command:
48-
- /manager
49-
args:
50-
- --leader-elect
51-
- --health-probe-bind-address=:8081
52-
image: capms-controller:latest
53-
imagePullPolicy: IfNotPresent
54-
name: manager
55-
securityContext:
56-
allowPrivilegeEscalation: false
57-
capabilities:
58-
drop:
59-
- "ALL"
60-
livenessProbe:
61-
httpGet:
62-
path: /healthz
63-
port: 8081
64-
initialDelaySeconds: 15
65-
periodSeconds: 20
66-
readinessProbe:
67-
httpGet:
68-
path: /readyz
69-
port: 8081
70-
initialDelaySeconds: 5
71-
periodSeconds: 10
72-
resources:
73-
limits:
74-
cpu: 500m
75-
memory: 128Mi
76-
requests:
77-
cpu: 10m
78-
memory: 64Mi
36+
- env:
37+
- name: METAL_API_URL
38+
valueFrom:
39+
secretKeyRef:
40+
name: controller-manager-config
41+
key: api-url
42+
- name: METAL_API_HMAC
43+
valueFrom:
44+
secretKeyRef:
45+
name: controller-manager-config
46+
key: api-hmac
47+
command:
48+
- /manager
49+
args:
50+
- --leader-elect
51+
- --health-probe-bind-address=:8081
52+
image: ghcr.io/metal-stack/capms-controller:latest
53+
imagePullPolicy: IfNotPresent
54+
name: manager
55+
securityContext:
56+
allowPrivilegeEscalation: false
57+
capabilities:
58+
drop:
59+
- "ALL"
60+
livenessProbe:
61+
httpGet:
62+
path: /healthz
63+
port: 8081
64+
initialDelaySeconds: 15
65+
periodSeconds: 20
66+
readinessProbe:
67+
httpGet:
68+
path: /readyz
69+
port: 8081
70+
initialDelaySeconds: 5
71+
periodSeconds: 10
72+
resources:
73+
limits:
74+
cpu: 500m
75+
memory: 128Mi
76+
requests:
77+
cpu: 10m
78+
memory: 64Mi
7979
serviceAccountName: controller-manager
8080
terminationGracePeriodSeconds: 10

metadata.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# maps release series of major.minor to cluster-api contract version
2+
# the contract version may change between minor or major versions, but *not*
3+
# between patch versions.
4+
#
5+
# update this file only when a new major or minor version is released
6+
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
7+
releaseSeries:
8+
- major: 0
9+
minor: 1
10+
contract: v1beta1

test/e2e/e2e_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var (
4343

4444
// projectImage is the name of the image which will be build and loaded
4545
// with the code source changes to be tested.
46-
projectImage = "capms-controller:latest"
46+
projectImage = "ghcr.io/metal-stack/capms-controller:latest"
4747
)
4848

4949
// TestE2E runs the end-to-end (e2e) test suite for the project. These tests execute in an isolated,

0 commit comments

Comments
 (0)