Skip to content

Commit

Permalink
Add make multipass target
Browse files Browse the repository at this point in the history
Add a `make multipass` target to start a dev env with all tools needed
for testing.
  • Loading branch information
michel-laterman committed Sep 20, 2024
1 parent 35c1e4a commit 895d88b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ help: ## - Show help message
@printf "${CMD_COLOR_ON} usage: make [target]\n\n${CMD_COLOR_OFF}"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | sed -e "s/^Makefile://" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: multipass
multipass: ## - Launch a multipass instance for development
ifeq ($(shell uname -p),arm)
$(eval ARCH := arm64)
else
$(eval ARCH := amd64)
endif
@cat dev-tools/multipass-cloud-init.yml.txt | GO_VERSION=${GO_VERSION} ARCH=${ARCH} envsubst > dev-tools/multipass-cloud-init.yml
@multipass launch --cloud-init=dev-tools/multipass-cloud-init.yml --mount ..:~/git --name fleet-server-dev --memory 8G --cpus 2 --disk 50G noble
@rm dev-tools/multipass-cloud-init.yml

.PHONY: list-platforms
list-platforms: ## - Show the possible PLATFORMS
@echo "${PLATFORMS}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
apt:
sources:
docker.list:
source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable
source: deb [arch=${ARCH}] https://download.docker.com/linux/ubuntu noble stable
keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
groups:
- docker
Expand All @@ -32,9 +32,12 @@ packages:
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
- unzip
- zip
write_files:
- content: |
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$(go env GOPATH)/bin
path: /etc/profile.d/go-bin.sh
# backwords compatibilityi alias for docker-compose
# makefile does not use the alias
Expand All @@ -43,6 +46,8 @@ write_files:
path: /etc/profile.d/docker-compose-alias.sh
runcmd:
- [ mkdir, /run/go ]
- [ wget, https://go.dev/dl/go1.20.4.linux-amd64.tar.gz, -O, /run/go/go.tar.gz ] # FIXME don't hardcode go version
- [ wget, https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz, -O, /run/go/go.tar.gz ]
- [ tar, -xzf, /run/go/go.tar.gz, -C, /usr/local/ ]
- [ rm, -rf, /run/go ]
- [ su, ubuntu, -c, "/usr/local/go/bin/go install github.com/magefile/mage@latest" ]
- [ su, ubuntu, -c, "/usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest" ]

0 comments on commit 895d88b

Please sign in to comment.