Skip to content

Commit

Permalink
multi arch for realz
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-mccoy committed Aug 1, 2022
1 parent 4e902fc commit a132fbe
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,27 @@ destroy:
$(ZARF_BIN) destroy --confirm --remove-components
rm -fr build

build-cli-linux-amd: build-injector-registry
build-cli-linux-amd: build-injector-registry-amd
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$(BUILD_ARGS)" -o build/zarf main.go

build-cli-linux-arm: build-injector-registry
build-cli-linux-arm: build-injector-registry-arm
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$(BUILD_ARGS)" -o build/zarf-arm main.go

build-cli-mac-intel: build-injector-registry
build-cli-mac-intel: build-injector-registry-amd
GOOS=darwin GOARCH=amd64 go build -ldflags="$(BUILD_ARGS)" -o build/zarf-mac-intel main.go

build-cli-mac-apple: build-injector-registry
build-cli-mac-apple: build-injector-registry-arm
GOOS=darwin GOARCH=arm64 go build -ldflags="$(BUILD_ARGS)" -o build/zarf-mac-apple main.go

build-cli-linux: build-cli-linux-amd build-cli-linux-arm

build-cli: build-cli-linux-amd build-cli-linux-arm build-cli-mac-intel build-cli-mac-apple ## Build the CLI

build-injector-registry:
cd src/injector/stage2 && $(MAKE) build-bootstrap-registry
build-injector-registry-amd:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o build/zarf-registry-amd64 src/injector/stage2/registry.go

build-injector-registry-arm:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o build/zarf-registry-arm64 src/injector/stage2/registry.go

docs-and-schema:
go run main.go internal generate-cli-docs
Expand All @@ -82,7 +85,7 @@ dev-agent-image:
init-package: ## Create the zarf init package, macos "brew install coreutils" first
@test -s $(ZARF_BIN) || $(MAKE) build-cli

@test -s ./build/zarf-init-$(ARCH).tar.zst || $(ZARF_BIN) package create -o build -a $(ARCH) --set AGENT_IMAGE=$(AGENT_IMAGE) --confirm .
@test -s ./build/zarf-init-$(ARCH).tar.zst || $(ZARF_BIN) package create -l=trace -o build -a $(ARCH) --set AGENT_IMAGE=$(AGENT_IMAGE) --confirm .

ci-release: init-package ## Create the init package

Expand Down
1 change: 0 additions & 1 deletion docs/3-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ The `make build-cli` command builds a binary for each combinations of OS and arc
- `make build-cli-mac-apple`
- `make build-cli-linux-amd`
- `make build-cli-linux-arm`
- `make build-injector-registry`

You can learn more about building [here](./4-user-guide/1-the-zarf-cli/1-building-your-own-cli.md).
:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ The `make build-cli` command builds a binary for each combinations of OS and arc
- `make build-cli-mac-apple`
- `make build-cli-linux-amd`
- `make build-cli-linux-arm`
- `make build-injector-registry`
:::

#### Breaking Down Whats Happening
Expand Down
23 changes: 21 additions & 2 deletions packages/zarf-injector/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,32 @@ metadata:
components:
- name: zarf-injector
required: true
only:
cluster:
architecture: amd64
cosignKeyPath: ../../cosign.pub
files:
# Rust Injector Binary
- source: sget://defenseunicorns/zarf-injector:0.4.3
- source: sget://defenseunicorns/zarf-injector:amd64-v0.20.0-31-g4e902fc
target: "###ZARF_TEMP###/zarf-injector"
executable: true
# Go Registry Binary
- source: ../../build/zarf-registry
- source: ../../build/zarf-registry-amd64
target: "###ZARF_TEMP###/zarf-registry"
executable: true

- name: zarf-injector
required: true
only:
cluster:
architecture: arm64
cosignKeyPath: ../../cosign.pub
files:
# Rust Injector Binary
- source: sget://defenseunicorns/zarf-injector:arm64-v0.20.0-31-g4e902fc
target: "###ZARF_TEMP###/zarf-injector"
executable: true
# Go Registry Binary
- source: ../../build/zarf-registry-arm64
target: "###ZARF_TEMP###/zarf-registry"
executable: true

0 comments on commit a132fbe

Please sign in to comment.