-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "[build] don't require passwordless sudo (Closes #11292)" #12517
Conversation
@jusherma Could you help review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reverting a change which fixed a build issue (#11292). This should not be reverted
Current code also doesn't work. It does nothing.
|
@@ -241,8 +241,7 @@ endif | |||
DOCKER_LOCKFILE_SAVE := $(DOCKER_LOCKDIR)/docker_save.lock | |||
$(shell mkdir -m 0777 -p $(DOCKER_LOCKDIR)) | |||
$(shell [ -f $(DOCKER_LOCKFILE_SAVE) ] || (touch $(DOCKER_LOCKFILE_SAVE) && chmod 0777 $(DOCKER_LOCKFILE_SAVE))) | |||
$(docker run --rm -v $(DOCKER_ROOT)\:/mount alpine sh -c 'rm -rf /mount/') | |||
$(mkdir -p $(DOCKER_ROOT)) | |||
$(shell sudo rm -rf $(DOCKER_ROOT) && mkdir -p $(DOCKER_ROOT)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(shell sudo rm -rf $(DOCKER_ROOT) && mkdir -p $(DOCKER_ROOT)) | |
$(shell [ -d $(DOCKER_ROOT) ] && \ | |
docker run --rm -v $(DOCKER_ROOT)/..\:/mount $(DEFAULT_CONTAINER_REGISTRY)debian:buster \ | |
sh -c 'rm -rf /mount/$$(basename "$(DOCKER_ROOT)")') |
- debian:buster because we already use it for DOCKER_MACHINE in Makefile.work, but maybe need a variable for default release name.
- We mount a parent directory because we can't remove bind mounted directory itself.
- I think we don't need mkdir command. If $(DOCKER_ROOT) doesn't exist then docker creates it (https://docs.docker.com/storage/bind-mounts/).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Konstantin. I not sure if $(shell )
is needed. My understanding is that it tells make
to treat the command's output as if it were part of the makefile (https://www.gnu.org/software/make/manual/html_node/Shell-Function.html)
But if the above works, I'm not too particular about how it works. My only requirement is that sudo
isn't used as that breaks the builds for us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xumia
Could you please review this.
You added this feature in #11111
But side effect of your commit was requiring sudo for each make.
There was a fix for this in #11417.
But fix doesn't work correctly because:
- word
shell
was missed - It's not possible to remove bind-mounted directory itself
So at this moment fsroot directories are not removed when you do make.
Also this fix has some drawbacks:
- Docker image
alpine
is unnecessary dependency. We can use debian:buster instead (we already use it for DOCKER_MACHINE detection) - We don't have to remove fsroot directory and run docker container for this every time (e.g. when we use a native docker)
- We don't have to recreate this directory because docker does it anyway (if we use -v option).
I can do a pull request instead of suggestion. But in this case it will take some time because I haven't signed CCLA yet.
This reverts commit 4d48e60.
9514fdd
to
e83ff99
Compare
Close in favor of #15132 |
Reverts #11417
This docker image
alpine
is unnecessary dependency.