make runner-and-helper-docker-host fails with docker 23 and greater due to removal of --default-stack-orchestrator=swarm
Summary
The --default-stack-orchestrator=swarm flag was deprecated in docker 20.10 and removed in 23.0, but is still used unconditionally in make runner-and-helper-docker-host.
Steps to reproduce
Run make runner-and-helper-docker-host on a machine with docker 23 or greater installed.
Actual behavior
Build fails with:
unknown flag: --default-stack-orchestrator
See 'docker context create --help'.
Expected behavior
Build should succeed.
Relevant logs and/or screenshots
make runner-and-helper-docker-host on docker 26
$ make runner-and-helper-docker-host
# Building gitlab-runner in version 16.11.0~beta.10.gc42cdfe1 for host platform
make runner-bin BUILD_PLATFORMS="-osarch=linux/amd64"
make[1]: Entering directory '/home/awj/src/gitlab/gitlab-runner-main'
go install github.com/mitchellh/gox@9f712387e2d2c810d99040228f89ae5bb5dd21e5
# Building gitlab-runner in version 16.11.0~beta.10.gc42cdfe1 for -osarch=linux/amd64
gox -osarch=linux/amd64 \
-ldflags "-X gitlab.com/gitlab-org/gitlab-runner/common.NAME=gitlab-runner -X gitlab.com/gitlab-org/gitlab-runner/common.VERSION=16.11.0~beta.10.gc42cdfe1 -X gitlab.com/gitlab-org/gitlab-runner/common.REVISION=c42cdfe1 -X gitlab.com/gitlab-org/gitlab-runner/common.BUILT=2024-03-27T23:19:34+0000 -X gitlab.com/gitlab-org/gitlab-runner/common.BRANCH=main -w" \
-output="out/binaries/gitlab-runner-{{.OS}}-{{.Arch}}" \
gitlab.com/gitlab-org/gitlab-runner
Number of parallel builds: 7
--> linux/amd64: gitlab.com/gitlab-org/gitlab-runner
make[1]: Leaving directory '/home/awj/src/gitlab/gitlab-runner-main'
cp -f "out/binaries/gitlab-runner-linux-amd64" out/binaries/gitlab-runner
go install github.com/mitchellh/gox@9f712387e2d2c810d99040228f89ae5bb5dd21e5
gox -osarch=linux/amd64 -ldflags "-X gitlab.com/gitlab-org/gitlab-runner/common.NAME="gitlab-runner-helper" -X gitlab.com/gitlab-org/gitlab-runner/common.VERSION=16.11.0~beta.10.gc42cdfe1 -X gitlab.com/gitlab-org/gitlab-runner/common.REVISION=c42cdfe1 -X gitlab.com/gitlab-org/gitlab-runner/common.BUILT=2024-03-27T23:19:33+0000 -X gitlab.com/gitlab-org/gitlab-runner/common.BRANCH=main -w" -output=out/binaries/gitlab-runner-helper/gitlab-runner-helper.x86_64 gitlab.com/gitlab-org/gitlab-runner/apps/gitlab-runner-helper
Number of parallel builds: 7
--> linux/amd64: gitlab.com/gitlab-org/gitlab-runner/apps/gitlab-runner-helper
make[1]: Entering directory '/home/awj/src/gitlab/gitlab-runner-main'
go install github.com/mitchellh/gox@9f712387e2d2c810d99040228f89ae5bb5dd21e5
gox -osarch=linux/amd64 -ldflags "-X gitlab.com/gitlab-org/gitlab-runner/common.NAME="gitlab-runner-helper" -X gitlab.com/gitlab-org/gitlab-runner/common.VERSION=16.11.0~beta.10.gc42cdfe1 -X gitlab.com/gitlab-org/gitlab-runner/common.REVISION=c42cdfe1 -X gitlab.com/gitlab-org/gitlab-runner/common.BUILT=2024-03-27T23:19:38+0000 -X gitlab.com/gitlab-org/gitlab-runner/common.BRANCH=main -w" -output=out/binaries/gitlab-runner-helper/gitlab-runner-helper.x86_64 gitlab.com/gitlab-org/gitlab-runner/apps/gitlab-runner-helper
Number of parallel builds: 7
--> linux/amd64: gitlab.com/gitlab-org/gitlab-runner/apps/gitlab-runner-helper
Building helper image for: linux/amd64 based on alpine:3.18
unknown flag: --default-stack-orchestrator
See 'docker context create --help'.
make[1]: *** [Makefile.runner_helper.mk:245: out/helper-images/prebuilt-alpine-x86_64.tar] Error 125
make[1]: Leaving directory '/home/awj/src/gitlab/gitlab-runner-main'
make: *** [Makefile.runner_helper.mk:155: helper-dockerarchive-host] Error 2
Environment description
Local docker version
$ docker version
Client: Docker Engine - Community
Version: 26.0.0
API version: 1.45
Go version: go1.21.8
Git commit: 2ae903e
Built: Wed Mar 20 15:18:01 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 26.0.0
API version: 1.45 (minimum version 1.24)
Go version: go1.21.8
Git commit: 8b79278
Built: Wed Mar 20 15:18:01 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Used GitLab Runner version
The build test log above was conducted on commit c42cdfe1.
Possible fixes
Check for docker client version before passing the --default-stack-orchestrator=swarm flag.