Skip to content

Commit 0a9dba3

Browse files
Add GitHub Action
1 parent beb4894 commit 0a9dba3

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

.github/workflows/build.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: build
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
buildx:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
- name: Set up QEMU
13+
uses: docker/setup-qemu-action@v3
14+
with:
15+
platforms: linux/amd64,linux/arm64
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
- name: Login to GitHub Container Registry
19+
uses: docker/login-action@v3
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Build images
25+
run: |
26+
make push-multiarch-images

Makefile

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,29 @@ SOURCES := Makefile go.mod go.sum $(shell find $(DEST) -name '*.go' 2>/dev/null)
2424
HAS_GOX := $(shell command -v gox;)
2525
GOX_PARALLEL ?= 3
2626

27-
TARGETS ?= linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x
27+
TARGETS ?= linux/amd64 linux/arm64
2828
DIST_DIRS = find * -type d -exec
2929

3030
TEMP_DIR :=$(shell mktemp -d)
3131
TAR_FILE ?= rootfs.tar
3232

3333
GOOS ?= $(shell go env GOOS)
3434
GOPROXY ?= $(shell go env GOPROXY)
35-
VERSION ?= $(shell git describe --dirty --tags --match='v*')
35+
VERSION ?= $(shell git describe --dirty --tags --match='v*' --always)
3636
GOARCH :=
3737
GOFLAGS :=
3838
TAGS :=
3939
LDFLAGS := "-w -s -X 'k8s.io/component-base/version.gitVersion=$(VERSION)' -X 'k8s.io/cloud-provider-openstack/pkg/version.Version=$(VERSION)'"
4040
GOX_LDFLAGS := $(shell echo "$(LDFLAGS) -extldflags \"-static\"")
4141
REGISTRY ?= reg.infra.ske.eu01.stackit.cloud/stackitcloud
42+
GHCR ?= ghcr.io/stackitcloud
4243
IMAGE_OS ?= linux
4344
IMAGE_NAMES ?= openstack-cloud-controller-manager \
44-
cinder-csi-plugin \
45-
k8s-keystone-auth \
46-
octavia-ingress-controller \
47-
manila-csi-plugin \
48-
barbican-kms-plugin \
49-
magnum-auto-healer
45+
cinder-csi-plugin
5046
ARCH ?= amd64
51-
ARCHS ?= amd64 arm arm64 ppc64le s390x
47+
ARCHS ?= amd64 arm64
5248
BUILD_CMDS ?= openstack-cloud-controller-manager \
53-
cinder-csi-plugin \
54-
k8s-keystone-auth \
55-
octavia-ingress-controller \
56-
manila-csi-plugin \
57-
barbican-kms-plugin \
58-
magnum-auto-healer \
59-
client-keystone-auth
49+
cinder-csi-plugin
6050

6151
# CTI targets
6252

@@ -172,7 +162,7 @@ build-local-images: $(addprefix build-image-,$(IMAGE_NAMES))
172162
push-multiarch-image-%:
173163
$(CONTAINER_ENGINE) buildx build --output type=registry \
174164
--build-arg VERSION=$(VERSION) \
175-
--tag $(REGISTRY)/$*:$(VERSION) \
165+
--tag $(GHCR)/$*:$(VERSION) \
176166
--platform $(shell echo $(addprefix linux/,$(ARCHS)) | sed 's/ /,/g') \
177167
--target $* \
178168
.
@@ -191,11 +181,6 @@ ifndef HAS_GOX
191181
endif
192182
CGO_ENABLED=0 gox -parallel=$(GOX_PARALLEL) -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(GOX_LDFLAGS)' $(GIT_HOST)/$(BASE_DIR)/cmd/openstack-cloud-controller-manager/
193183
CGO_ENABLED=0 gox -parallel=$(GOX_PARALLEL) -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(GOX_LDFLAGS)' $(GIT_HOST)/$(BASE_DIR)/cmd/cinder-csi-plugin/
194-
CGO_ENABLED=0 gox -parallel=$(GOX_PARALLEL) -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(GOX_LDFLAGS)' $(GIT_HOST)/$(BASE_DIR)/cmd/k8s-keystone-auth/
195-
CGO_ENABLED=0 gox -parallel=$(GOX_PARALLEL) -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(GOX_LDFLAGS)' $(GIT_HOST)/$(BASE_DIR)/cmd/client-keystone-auth/
196-
CGO_ENABLED=0 gox -parallel=$(GOX_PARALLEL) -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(GOX_LDFLAGS)' $(GIT_HOST)/$(BASE_DIR)/cmd/octavia-ingress-controller/
197-
CGO_ENABLED=0 gox -parallel=$(GOX_PARALLEL) -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(GOX_LDFLAGS)' $(GIT_HOST)/$(BASE_DIR)/cmd/manila-csi-plugin/
198-
CGO_ENABLED=0 gox -parallel=$(GOX_PARALLEL) -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(GOX_LDFLAGS)' $(GIT_HOST)/$(BASE_DIR)/cmd/magnum-auto-healer/
199184

200185
.PHONY: dist
201186
dist: build-cross

0 commit comments

Comments
 (0)