Skip to content

Commit

Permalink
chore: add tasks to download tofu binary per OS and ARCH
Browse files Browse the repository at this point in the history
  • Loading branch information
YrrepNoj committed Jan 17, 2025
1 parent 1ea9188 commit ad7bee7
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,41 @@ tasks:
setVariables:
- name: BUILD_ARGS
# TODO: This is a naive (AND BROKEN!!!) solution. This will only work for a single architecture.
# We need to create subcommands to install specific arch + OS versions of Tofu
- name: copy-tofu-bin
- name: download-tofu-mac-intel
description: download tofu for go:embed
actions:
- cmd: mkdir -p src/cmd/bin
- cmd: cp -Lf $(which tofu) src/cmd/bin/
- cmd: rm -f src/cmd/bin/tofu
- cmd: wget https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_darwin_amd64.zip -O src/cmd/bin/tofu_1.9.0_darwin_amd64.zip
- cmd: unzip -p src/cmd/bin/tofu_1.9.0_darwin_amd64.zip tofu > src/cmd/bin/tofu
- cmd: rm src/cmd/bin/tofu_1.9.0_darwin_amd64.zip

- name: download-tofu-mac-apple
description: download tofu for go:embed
actions:
- cmd: mkdir -p src/cmd/bin
- cmd: rm -f src/cmd/bin/tofu
- cmd: wget https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_darwin_arm64.zip -O src/cmd/bin/tofu_1.9.0_darwin_arm64.zip
- cmd: unzip -p src/cmd/bin/tofu_1.9.0_darwin_arm64.zip tofu > src/cmd/bin/tofu
- cmd: rm src/cmd/bin/tofu_1.9.0_darwin_arm64.zip

- name: download-tofu-linux-arm
description: download tofu for go:embed
actions:
- cmd: mkdir -p src/cmd/bin
- cmd: rm -f src/cmd/bin/tofu
- cmd: wget https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_linux_arm64.zip -O src/cmd/bin/tofu_1.9.0_linux_arm64.zip
- cmd: unzip -p src/cmd/bin/tofu_1.9.0_linux_arm64.zip tofu > src/cmd/bin/tofu
- cmd: rm src/cmd/bin/tofu_1.9.0_linux_arm64.zip

- name: download-tofu-linux-amd
description: download tofu for go:embed
actions:
- cmd: mkdir -p src/cmd/bin
- cmd: rm -f src/cmd/bin/tofu
- cmd: wget https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_linux_amd64.zip -O src/cmd/bin/tofu_1.9.0_linux_amd64.zip
- cmd: unzip -p src/cmd/bin/tofu_1.9.0_linux_amd64.zip tofu > src/cmd/bin/tofu
- cmd: rm src/cmd/bin/tofu_1.9.0_linux_amd64.zip

- name: build-all
description: build all the CLI binaries and gen checksums
Expand All @@ -76,29 +104,29 @@ tasks:
actions:
- task: get-versions
- task: build-args
- task: copy-tofu-bin
- task: download-tofu-linux-amd
- cmd: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${BUILD_ARGS}" -o build/uds main.go

- name: build-cli-linux-arm
description: build the CLI for Linux ARM64
actions:
- task: get-versions
- task: build-args
- task: copy-tofu-bin
- task: download-tofu-linux-arm
- cmd: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="${BUILD_ARGS}" -o build/uds-arm main.go

- name: build-cli-mac-intel
description: build the CLI for Mac Intel
actions:
- task: get-versions
- task: build-args
- task: copy-tofu-bin
- task: download-tofu-mac-intel
- cmd: GOOS=darwin GOARCH=amd64 go build -ldflags="${BUILD_ARGS}" -o build/uds-mac-intel main.go

- name: build-cli-mac-apple
description: build the CLI for Mac Apple
actions:
- task: get-versions
- task: build-args
- task: copy-tofu-bin
- task: download-tofu-mac-apple
- cmd: GOOS=darwin GOARCH=arm64 go build -ldflags="${BUILD_ARGS}" -o build/uds-mac-apple main.go

0 comments on commit ad7bee7

Please sign in to comment.