Commit c3b56937 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

cerbero: Never use cached cerbero git repo

Sometimes the git repo cached on the docker image gets corrupted on
Windows, in which case there is no way to clean things and resolve
that error. For example:

++ cp -a C:/cerbero/.git .
cp: cannot create regular file `./.git/objects/pack/pack-cbdde9dc4dd07bff6761e6715e20d7c0abe62b9e.idx': Permission denied
cp: cannot create regular file `./.git/objects/pack/pack-cbdde9dc4dd07bff6761e6715e20d7c0abe62b9e.pack': Permission denied

Always delete the cached git repo and copy a pristine copy from the
image. This will also avoid accumulation of garbage in the git repo.

Part-of: <!376>
parent aead7b4e
Pipeline #229522 failed with stages
in 10 minutes and 29 seconds
......@@ -86,7 +86,15 @@ cerbero_before_script() {
ls -lha
# Copy cerbero git repo stored on the image
# Copy cerbero git repo stored on the image, delete an existing checkout if
# it exists. Sometimes the git dir gets corrupted on the Windows runner,
# and there's no way to clean it up because gitlab will keep trying to
# reuse the cached image.
if ! [[ -d ${CERBERO_HOST_DIR}/.git ]]; then
mv "${CERBERO_HOST_DIR}/.git" "${CERBERO_HOST_DIR}/.git-old"
# rm -rf is very slow on Windows, so do it in the background
rm -rf "${CERBERO_HOST_DIR}/.git-old" &
cp -a "${CERBERO_HOST_DIR}/.git" .
git checkout .
git status
......@@ -114,6 +122,9 @@ cerbero_before_script() {
# a dirty builddir, or tarballs/pkg files, leftover files from an old
# cerbero commit, etc. Skip the things we actually need to keep.
time git clean -xdff -e -e manifest.xml -e localconf.cbc -e "${CERBERO_SOURCES}"
# Wait for the rm -rf from above if needed
[[ -n $(jobs -p) ]] && fg
Please register or sign in to reply
cerbero_script() {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment