graphdriver: custom build-time priority list#35522
Conversation
|
I think we should have a document about these overridable variables |
There was a problem hiding this comment.
This can (and should) be a const.
There was a problem hiding this comment.
It can not be a const because const can not be overridden with -X.
|
I reckon that the ideal way of doing this would be to have |
I don't think |
@cyphar Makes sense (except it can't be const). Please see the updated commit |
|
Please add a document about this? then LGTM |
|
@kolyshkin 👍, plus the comment about documenting it in a Makefile. |
|
@AkihiroSuda @cyphar you mean the top-level Makefile? Would something like this be sufficient? diff --git a/Makefile b/Makefile
index 547230fb1..cb5980d2f 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,13 @@ export DOCKER_GITCOMMIT
# env vars passed through directly to Docker's build scripts
# to allow things like `make KEEPBUNDLE=1 binary` easily
# `project/PACKAGERS.md` have some limited documentation of some of these
+#
+# DOCKER_LDFLAGS can be used to pass additional parameters to -ldflags
+# option of "go build". For example, a built-in graphdriver priority list
+# can be changed during build time like this:
+#
+# make DOCKER_LDFLAGS="-X github.com/docker/docker/daemon/graphdriver.priority=overlay2,devicemapper" dynbinary
+#
DOCKER_ENVS := \
-e DOCKER_CROSSPLATFORMS \
-e BUILD_APT_MIRROR \ |
Add a way to specify a custom graphdriver priority list during build. This can be done with something like go build -ldflags "-X github.com/docker/docker/daemon/graphdriver.priority=overlay2,devicemapper" As ldflags are already used by the engine build process, and it seems that only one (last) `-ldflags` argument is taken into account by go, an envoronment variable `DOCKER_LDFLAGS` is introduced in order to be able to append some text to `-ldflags`. With this in place, using the feature becomes make DOCKER_LDFLAGS="-X github.com/docker/docker/daemon/graphdriver.priority=overlay2,devicemapper" dynbinary The idea behind this is, the priority list might be different for different distros, so vendors are now able to change it without patching the source code. Signed-off-by: Kir Kolyshkin <[email protected]>
|
LGTM |
Add a way to specify a custom graphdriver priority list during build. This can be done with something like
As ldflags are already used by the engine build process, and it seems that only one (last)
-ldflagsargument is taken into account by go, an envoronment variableDOCKER_LDFLAGSis introduced in order to be able to append some text to-ldflags. With this in place, using the feature becomesIf this variable is either unset during compile time or empty, the default list (
priority) is used.The idea behind this is, the priority list might be different for different distros, so vendors are now able to change it without patching the source code.