Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Build & Release

on:
push:
branches: [main]
tags: ["v*"]

permissions: {}

jobs:
build:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0

- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=sha

- uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod

- name: Run tests
run: make test

- name: Build release assets
env:
IMAGE: ghcr.io/${{ github.repository }}:${{ github.ref_name }}
run: |
make clusterctl-release \
IMG="${IMAGE}" \
CLUSTERCTL_RELEASE_VERSION="${GITHUB_REF_NAME}"
make build-installer IMG="${IMAGE}"

- name: Generate checksums
run: |
release_dir="dist/clusterctl/infrastructure-stackit/${GITHUB_REF_NAME}"
(
cd "${release_dir}"
find . -type f ! -name checksums.txt -print0 | sort -z | xargs -0 sha256sum
) > "${release_dir}/checksums.txt"
sha256sum dist/install.yaml >> "${release_dir}/checksums.txt"

- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
release_dir="dist/clusterctl/infrastructure-stackit/${TAG}"
gh release create "${TAG}" \
--title "${TAG}" \
--generate-notes \
"${release_dir}"/* \
"${release_dir}"/addons/* \
dist/install.yaml
43 changes: 0 additions & 43 deletions .github/workflows/build-container-image.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

Expand Down Expand Up @@ -67,4 +67,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,11 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
.PHONY: build-installer
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
mkdir -p dist
cd config/manager && "$(KUSTOMIZE)" edit set image controller=${IMG}
"$(KUSTOMIZE)" build config/default > dist/install.yaml
tmp_dir="$$(mktemp -d)"; \
trap 'rm -rf "$$tmp_dir"' EXIT; \
cp -R config "$$tmp_dir/config"; \
cd "$$tmp_dir/config/manager" && "$(KUSTOMIZE)" edit set image controller=${IMG}; \
"$(KUSTOMIZE)" build "$$tmp_dir/config/default" > "$(CURDIR)/dist/install.yaml"

.PHONY: clusterctl-release
clusterctl-release: manifests generate kustomize ## Generate clusterctl release assets.
Expand Down
19 changes: 18 additions & 1 deletion docs/src/usage/clusterctl.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# clusterctl

The provider can be packaged as a local clusterctl repository:
Each release publishes `infrastructure-components.yaml`, `metadata.yaml`, and
cluster templates as GitHub Release assets. Install a published version with:

```sh
clusterctl init \
--infrastructure \
https://github.com/stackitcloud/cluster-api-provider-stackit/releases/download/v<version>/infrastructure-components.yaml
```

Or latest:

```sh
clusterctl init \
--infrastructure \
https://github.com/stackitcloud/cluster-api-provider-stackit/releases/download/latest/infrastructure-components.yaml
```

For local development, package the provider as a local clusterctl repository:

```sh
make clusterctl-release IMG=<registry>/cluster-api-provider-stackit:<tag>
Expand Down