Skip to content

Commit

Permalink
[build] don't require passwordless sudo sonic-net#11417
Browse files Browse the repository at this point in the history
Why I did it
Not all build environments have passwordless sudo enabled for all users

How I did it
Instead of using sudo to delete fsroot directories, mount them in a small, temporary docker container and delete them from there

How to verify it
Build in an environment where the build user does not have passwordless sudo enabled and confirm that no sudo password prompts are seen
  • Loading branch information
jusherma authored Jul 26, 2022
1 parent 5afa940 commit 4d48e60
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ 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)))
$(shell sudo rm -rf $(DOCKER_ROOT) && mkdir -p $(DOCKER_ROOT))
$(docker run --rm -v $(DOCKER_ROOT)\:/mount alpine sh -c 'rm -rf /mount/')
$(mkdir -p $(DOCKER_ROOT))

ifeq ($(DOCKER_BUILDER_MOUNT),)
override DOCKER_BUILDER_MOUNT := "$(PWD):/sonic"
Expand Down

0 comments on commit 4d48e60

Please sign in to comment.