-
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
05.Version cache - docker dpkg caching support #12005
05.Version cache - docker dpkg caching support #12005
Conversation
This pull request introduces 1 alert when merging a7949e321850d73be472e832a750aeb9d102cf16 into 38cc35f - view on LGTM.com new alerts:
|
/azpw run Azure.sonic-buildimage |
/AzurePipelines run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
@xumia @liushilongbuaa submitter has taken the time to split the original code PR to smaller submissions for review, pls help take a look |
a7949e3
to
1c3ee38
Compare
@xumia @liushilongbuaa can you please review the PR? Thanks. |
Makefile.work
Outdated
@@ -217,15 +230,21 @@ SLAVE_TAG = $(shell \ | |||
(cat $(SLAVE_DIR)/Dockerfile.user \ | |||
$(SLAVE_DIR)/Dockerfile \ | |||
$(SLAVE_DIR)/buildinfo/versions/versions-* \ | |||
.git/HEAD \ | |||
.git/HEAD 2>/dev/null \ |
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.
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.
done
#echo ${!lock_fd} | ||
if ! flock -x -w ${timeout} "${!lock_fd}" ; then | ||
echo "ERROR: Lock timeout trying to access ${filename}.flock"; | ||
exit 1; |
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.
How about printing to stderr
echo "ERROR: Lock timeout trying to access ${filename}.flock" 1>&2;
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.
done
APT::Keep-Downloaded-Packages "true"; | ||
EOF | ||
|
||
fi |
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.
Please remove the empty line
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.
done
# Extract the cache inside the docker build. | ||
if [ -f ${PKG_CACHE_FILE_NAME} ]; then | ||
tar -C ${PKG_CACHE_PATH} -xvf ${PKG_CACHE_FILE_NAME} | ||
test -e ${PKG_CACHE_PATH}/deb && cp ${PKG_CACHE_PATH}/deb/* /var/cache/apt/archives/ |
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.
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.
done
715bbc5
to
68ed10e
Compare
68ed10e
to
b041acb
Compare
It defines and passes the necessary version cache environment variables to the caching framework. It adds the utils script for shared cache file access. It also adds the post-cleanup logic for cleaning the unwanted files from the docker/image after the version cache creation.
Added DBGOPT Make variable to enable the cache framework scripts in trace mode. This option takes the part name of the script to enable the particular shell script in trace mode. Multiple shell script names can also be given. Eg: make DBGOPT="image|docker" Added verbose mode to dump the version merge details during build/dry-run mode. Eg: scripts/versions_manager.py freeze -v \ 'dryrun|cmod=docker-swss|cfile=versions-deb|cname=all|stage=sub|stage=add'
This feature caches all the deb files during docker build and stores them into version cache. It loads the cache file if already exists in the version cache and copies the extracted deb file from cache file into Debian cache path( /var/cache/apt/archives). The apt-install always installs the deb file from the cache if exists, this avoid unnecessary package download from the repo and speeds up the overall build. The cache file is selected based on the SHA value of version dependency files.
b041acb
to
6660b29
Compare
@Kalimuthu-Velappan PR conflicts with 202211 branch |
@Kalimuthu-Velappan can this be cherry-picked to the 202211 and 202205 branches? This will save about 100MB of disk space, which will be immensely helpful on low-storage platforms. |
@Kalimuthu-Velappan this change is desired for 202205 branch to help reduce image size and installation footprint. Please help create PR for 202205 branch. |
@Kalimuthu-Velappan PR conflicts with 202205 branch |
…)" This reverts commit 0dc22bd.
Revert "05.Version cache - docker dpkg caching support (sonic-net#12005)" This reverts commit 0dc22bd.
…-net#12005)"" This reverts commit 4be0805.
This feature caches all the deb files during docker build and stores them into version cache. It loads the cache file if already exists in the version cache and copies the extracted deb file from cache file into Debian cache path( /var/cache/apt/archives). The apt-install always installs the deb file from the cache if exists, this avoid unnecessary package download from the repo and speeds up the overall build. The cache file is selected based on the SHA value of version dependency files. Why I did it How I did it How to verify it * 03.Version-cache - framework environment settings It defines and passes the necessary version cache environment variables to the caching framework. It adds the utils script for shared cache file access. It also adds the post-cleanup logic for cleaning the unwanted files from the docker/image after the version cache creation. * 04.Version cache - debug framework Added DBGOPT Make variable to enable the cache framework scripts in trace mode. This option takes the part name of the script to enable the particular shell script in trace mode. Multiple shell script names can also be given. Eg: make DBGOPT="image|docker" Added verbose mode to dump the version merge details during build/dry-run mode. Eg: scripts/versions_manager.py freeze -v \ 'dryrun|cmod=docker-swss|cfile=versions-deb|cname=all|stage=sub|stage=add' * 05.Version cache - docker dpkg caching support This feature caches all the deb files during docker build and stores them into version cache. It loads the cache file if already exists in the version cache and copies the extracted deb file from cache file into Debian cache path( /var/cache/apt/archives). The apt-install always installs the deb file from the cache if exists, this avoid unnecessary package download from the repo and speeds up the overall build. The cache file is selected based on the SHA value of version dependency files.
This feature caches all the deb files during docker build and stores them
into version cache.
It loads the cache file if already exists in the version cache and copies the extracted
deb file from cache file into Debian cache path( /var/cache/apt/archives).
The apt-install always installs the deb file from the cache if exists, this
avoid unnecessary package download from the repo and speeds up the overall build.
The cache file is selected based on the SHA value of version dependency
files.
Why I did it
How I did it
How to verify it
Which release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)