diff --git a/.goreleaser.yml b/.goreleaser.yml index 1e21f2f3b59..bfb198b292a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -13,8 +13,6 @@ snapshot: env: - GOPROXY={{ if index .Env "GOPROXY" }}{{ .Env.GOPROXY }}{{ else }}https://proxy.golang.org,direct{{ end }} - GOSUMDB={{ if index .Env "GOSUMDB" }}{{ .Env.GOSUMDB }}{{ else }}sum.golang.org{{ end }} - # If set, BASE_IMAGE determines the base image used for all containers. - - BASE_IMAGE_ARG={{ if index .Env "BASE_IMAGE" }}BASE_IMAGE={{ .Env.BASE_IMAGE }}{{ else }}{{ end }} - DOCKER_REPO={{ if index .Env "DOCKER_REPO" }}{{ .Env.DOCKER_REPO }}/{{ else }}gresearch/{{ end }} # Goreleaser always uses the docker buildx builder with name "default"; see # https://github.com/goreleaser/goreleaser/pull/3199 @@ -206,7 +204,6 @@ dockers: - "{{ .Env.DOCKER_REPO }}armada-bundle:latest" - "{{ .Env.DOCKER_REPO }}armada-bundle:{{ .Version }}" build_flag_templates: &BUILD_FLAG_TEMPLATES - - --build-arg={{ .Env.BASE_IMAGE_ARG }} - --builder={{ .Env.DOCKER_BUILDX_BUILDER }} - --cache-to={{ .Env.DOCKER_BUILDX_CACHE_TO }} - --cache-from={{ .Env.DOCKER_BUILDX_CACHE_FROM }} diff --git a/magefiles/goreleaser.go b/magefiles/goreleaser.go index 852680dcad9..ae7711179fb 100644 --- a/magefiles/goreleaser.go +++ b/magefiles/goreleaser.go @@ -3,11 +3,8 @@ package main import ( "fmt" "os" - "regexp" "time" - "golang.org/x/exp/slices" - goreleaserConfig "github.com/goreleaser/goreleaser/pkg/config" "github.com/magefile/mage/sh" "github.com/pkg/errors" @@ -54,30 +51,8 @@ func goreleaserWriteMinimalReleaseConfig(dockerIds ...string) error { dockerIdsToBuild := set(dockerIds) dockersById := make(map[string]goreleaserConfig.Docker) buildIds := make(map[string]bool) - - // BASE_IMAGE_ARG is derived from BASE_IMAGE - see .goreleaser.yml - buildArgBaseRE := regexp.MustCompile("--build-arg=.*BASE_IMAGE_ARG") - for _, docker := range config.Dockers { if dockerIdsToBuild[docker.ID] { - // Goreleaser constructs a faulty `docker build` command if the environment - // variable BASE_IMAGE is not defined - it constructs a `--build-arg= ` option - // (no value given) and `docker build` immediately errors. As a work-around - // we filter out that whole template option entry if BASE_IMAGE is not defined; - // see .goreleaser.yml for how it's used. Goreleaser does not support conditional - // templating of YAML in its 'dockers' section, so we filter it out here. - if os.Getenv("BASE_IMAGE") == "" { - deleteIdx := -1 - for idx, tpl := range docker.BuildFlagTemplates { - if buildArgBaseRE.MatchString(tpl) { - deleteIdx = idx - break - } - } - - docker.BuildFlagTemplates = slices.Delete(docker.BuildFlagTemplates, deleteIdx, deleteIdx+1) - } - dockersById[docker.ID] = docker for _, id := range docker.IDs { buildIds[id] = true