Skip to content

Commit

Permalink
Add GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
robinschneider committed Mar 14, 2024
1 parent d34baf0 commit b8c84eb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: build

on:
push:

jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build images
run: |
make push-multiarch-images
29 changes: 7 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,29 @@ SOURCES := Makefile go.mod go.sum $(shell find $(DEST) -name '*.go' 2>/dev/null)
HAS_GOX := $(shell command -v gox;)
GOX_PARALLEL ?= 3

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

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

GOOS ?= $(shell go env GOOS)
GOPROXY ?= $(shell go env GOPROXY)
VERSION ?= $(shell git describe --dirty --tags --match='v*')
VERSION ?= $(shell git describe --dirty --tags --match='v*' --always)
GOARCH :=
GOFLAGS :=
TAGS :=
LDFLAGS := "-w -s -X 'k8s.io/component-base/version.gitVersion=$(VERSION)' -X 'k8s.io/cloud-provider-openstack/pkg/version.Version=$(VERSION)'"
GOX_LDFLAGS := $(shell echo "$(LDFLAGS) -extldflags \"-static\"")
REGISTRY ?= reg.infra.ske.eu01.stackit.cloud/stackitcloud
GHCR ?= ghcr.io/stackitcloud
IMAGE_OS ?= linux
IMAGE_NAMES ?= openstack-cloud-controller-manager \
cinder-csi-plugin \
k8s-keystone-auth \
octavia-ingress-controller \
manila-csi-plugin \
barbican-kms-plugin \
magnum-auto-healer
cinder-csi-plugin
ARCH ?= amd64
ARCHS ?= amd64 arm arm64 ppc64le s390x
ARCHS ?= amd64 arm64
BUILD_CMDS ?= openstack-cloud-controller-manager \
cinder-csi-plugin \
k8s-keystone-auth \
octavia-ingress-controller \
manila-csi-plugin \
barbican-kms-plugin \
magnum-auto-healer \
client-keystone-auth
cinder-csi-plugin

# CTI targets

Expand Down Expand Up @@ -172,7 +162,7 @@ build-local-images: $(addprefix build-image-,$(IMAGE_NAMES))
push-multiarch-image-%:
$(CONTAINER_ENGINE) buildx build --output type=registry \
--build-arg VERSION=$(VERSION) \
--tag $(REGISTRY)/$*:$(VERSION) \
--tag $(GHCR)/$*:$(VERSION) \
--platform $(shell echo $(addprefix linux/,$(ARCHS)) | sed 's/ /,/g') \
--target $* \
.
Expand All @@ -191,11 +181,6 @@ ifndef HAS_GOX
endif
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/
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/
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/
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/
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/
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/
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/

.PHONY: dist
dist: build-cross
Expand Down

0 comments on commit b8c84eb

Please sign in to comment.