Skip to content

Commit

Permalink
register: build it with CGO (#169)
Browse files Browse the repository at this point in the history
* register: build it with CGO
It's needed to be able to use TPM emulation.
* goreleaser: add entry for elemental-support

Signed-off-by: Loic Devulder <[email protected]>
  • Loading branch information
ldevulder authored Sep 8, 2022
1 parent 832ee7f commit 72ef079
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand All @@ -20,6 +22,27 @@ 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}}
- -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
- 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}}
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
helm upgrade -n cattle-elemental-system elemental-operator $(CHART)

0 comments on commit 72ef079

Please sign in to comment.