From 675c285dffd84e28389a849caa0262abd8b04598 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 23 Sep 2024 02:54:48 -0400 Subject: [PATCH] fix: respect GO* environment variables when building to ensure CGO is disabled Without this, building Dokku on a newer operating system will result in binaries that do not work on older systems. The environment variables were only being set when building in docker, which has not been used in the release workflow for a while. --- Makefile | 4 ++-- go.work | 2 +- plugins/app-json/Makefile | 3 +++ plugins/scheduler-k3s/go.mod | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7efcaacaa..10408d299 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ go-build: basedir=$(PWD); \ for dir in plugins/*; do \ if [ -e $$dir/Makefile ]; then \ - $(MAKE) -e -C $$dir $(PLUGIN_MAKE_TARGET) || exit $$? ;\ + GO_ARGS='$(GO_ARGS)' CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) GOWORK=off $(MAKE) -e -C $$dir $(PLUGIN_MAKE_TARGET) || exit $$? ;\ fi ;\ done @@ -64,7 +64,7 @@ ifndef PLUGIN_NAME $(error PLUGIN_NAME not specified) endif if [ -e plugins/$(PLUGIN_NAME)/Makefile ]; then \ - $(MAKE) -e -C plugins/$(PLUGIN_NAME) $(PLUGIN_MAKE_TARGET) || exit $$? ;\ + GO_ARGS='$(GO_ARGS)' CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) GOWORK=off $(MAKE) -e -C plugins/$(PLUGIN_NAME) $(PLUGIN_MAKE_TARGET) || exit $$? ;\ fi go-clean: diff --git a/go.work b/go.work index e94ab88cb..72ea6651e 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.23 +go 1.23.0 use ( ./plugins/app-json diff --git a/plugins/app-json/Makefile b/plugins/app-json/Makefile index 229186118..5283fc5db 100644 --- a/plugins/app-json/Makefile +++ b/plugins/app-json/Makefile @@ -3,4 +3,7 @@ TRIGGERS = triggers/app-json-process-deploy-parallelism triggers/app-json-get-co BUILD = commands subcommands triggers PLUGIN_NAME = app-json +goenv: + go env + include ../../common.mk diff --git a/plugins/scheduler-k3s/go.mod b/plugins/scheduler-k3s/go.mod index ab682d225..67a6dcfc4 100644 --- a/plugins/scheduler-k3s/go.mod +++ b/plugins/scheduler-k3s/go.mod @@ -1,6 +1,6 @@ module github.com/dokku/dokku/plugins/scheduler-k3s -go 1.23 +go 1.23.0 require ( github.com/cert-manager/cert-manager v1.13.3