Skip to content
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

Lock build_debuian.sh execution to prevent issue with parallel access… #222

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT depmod -a {{kversion}}
{% for image in installer_images.strip().split(' ') -%}
sudo LANG=C chroot $FILESYSTEM_ROOT docker load < {{image}}
{% endfor %}
sudo chroot $FILESYSTEM_ROOT service docker stop
sudo chroot $FILESYSTEM_ROOT service docker stop || true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why make this always successful?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are investigating the root cause for this failure.

{% for script in installer_start_scrips.split(' ') -%}
sudo cp {{script}} $FILESYSTEM_ROOT/usr/bin/
{% endfor %}
Expand Down
15 changes: 14 additions & 1 deletion slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,20 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform
chmod +x sonic_debian_extension.sh,
)

./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG)
# Lock build_debian.sh execution to prevent issue with parallel accessing to docker engine.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parallel accessing to docker engine from who?

INSTALLER_LOCK=/var/lock/sonic-buildimage-inіtaller.lock
while true; do
[ mkdir $(INSTALLER_LOCK) &>/dev/null ] && {
./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) || {
rm -rf $(INSTALLER_LOCK_FILE)
exit 1
}

rm -rf $(INSTALLER_LOCK_FILE)
break
}
done

TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG)

$(foreach docker, $($*_DOCKERS), \
Expand Down