From 9da207511fb5ff084d6845d172731ef4c9c943bc Mon Sep 17 00:00:00 2001 From: Loic Devulder Date: Thu, 8 Sep 2022 14:13:44 +0200 Subject: [PATCH 1/2] register: build it with CGO It's needed to be able to use TPM emulation. Signed-off-by: Loic Devulder --- .goreleaser.yaml | 4 ++++ Makefile | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 883392715..6a91131d8 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -3,6 +3,8 @@ builds: - main: ./cmd/operator binary: elemental-operator id: elemental-operator + env: + - CGO_ENABLED=0 ldflags: - -w -s - -X github.com/rancher/elemental-operator/pkg/version.Version={{.Tag}} @@ -20,6 +22,8 @@ builds: - main: ./cmd/register binary: elemental-register id: elemental-register + env: + - CGO_ENABLED=1 ldflags: - -w -s - -X github.com/rancher/elemental-operator/pkg/version.Version={{.Tag}} diff --git a/Makefile b/Makefile index e0526f40c..2c510823c 100644 --- a/Makefile +++ b/Makefile @@ -22,16 +22,16 @@ build: operator register support .PHONY: operator operator: - go build -ldflags '$(LDFLAGS)' -o build/elemental-operator $(ROOT_DIR)/cmd/operator + CGO_ENABLED=0 go build -ldflags '$(LDFLAGS)' -o build/elemental-operator $(ROOT_DIR)/cmd/operator .PHONY: register register: - go build -ldflags '$(LDFLAGS)' -o build/elemental-register $(ROOT_DIR)/cmd/register + CGO_ENABLED=1 go build -ldflags '$(LDFLAGS)' -o build/elemental-register $(ROOT_DIR)/cmd/register .PHONY: support support: - go build -ldflags '$(LDFLAGS)' -o build/elemental-support $(ROOT_DIR)/cmd/support + CGO_ENABLED=0 go build -ldflags '$(LDFLAGS)' -o build/elemental-support $(ROOT_DIR)/cmd/support .PHONY: build-docker-operator @@ -113,4 +113,4 @@ kind-e2e-tests: build-docker-operator chart setup-kind # thus losing any registration/inventories/os CRDs already created reload-operator: build-docker-operator chart kind load docker-image --name $(CLUSTER_NAME) ${REPO}:${TAG} - helm upgrade -n cattle-elemental-system elemental-operator $(CHART) \ No newline at end of file + helm upgrade -n cattle-elemental-system elemental-operator $(CHART) From 4d55345ac4f58bd6b2c3e5611df71849ff2e5d34 Mon Sep 17 00:00:00 2001 From: Loic Devulder Date: Thu, 8 Sep 2022 14:39:10 +0200 Subject: [PATCH 2/2] goreleaser: add entry for elemental-support Signed-off-by: Loic Devulder --- .goreleaser.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6a91131d8..c761b8035 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -38,6 +38,25 @@ builds: goarm: - 6 - 7 + - main: ./cmd/support + binary: elemental-support + id: elemental-support + env: + - CGO_ENABLED=0 + ldflags: + - -w -s + - -X github.com/rancher/elemental-operator/pkg/version.Version={{.Tag}} + - -X github.com/rancher/elemental-operator/pkg/version.Commit={{.Commit}} + - -X github.com/rancher/elemental-operator/pkg/version.CommitDate={{.CommitDate}} + goos: + - linux + goarch: + - amd64 + - arm + - arm64 + goarm: + - 6 + - 7 source: enabled: true name_template: '{{ .ProjectName }}-{{ .Tag }}-source'