James E. Blair 421e59f7bc Add debian-bullseye image
This adds an initial debian bullseye dib build job.

Depends-On: https://review.opendev.org/929147
Change-Id: I63f4077305981b7fbce850ae642923cc117a7810
2024-09-12 19:04:00 -07:00

28 lines
1.1 KiB
YAML

- name: Reformat the git repo cache for source-repositories
environment: "{{ build_diskimage_environment }}"
args:
executable: /bin/bash
shell: |
GIT_CACHE_ROOT="{{ cached_repos_root }}"
REPOTYPE=git
CACHE_BASE=${DIB_IMAGE_CACHE}/source-repositories
mkdir -p ${CACHE_BASE}
# Note: maxdepth 4 is based on the current opendev practice of
# not having repos deeper than two directory levels. This is
# fragile and should probably be replaced with something better,
# but as written it saves considerable time.
for NODE_CACHE_PATH in $(find $GIT_CACHE_ROOT -maxdepth 4 -type d -name .git); do
REPOPATH=$(dirname $NODE_CACHE_PATH)
REPONAME=$(basename $REPOPATH)
REPOLOCATION="$(echo $REPOPATH | sed "s,$GIT_CACHE_ROOT/,https://,").git"
# From diskimage-builder element source-repositories
CACHE_NAME=$(echo "${REPOTYPE}_${REPOLOCATION}" | sha1sum | awk '{ print $1 }' )
CACHE_NAME=${REPONAME//[^A-Za-z0-9]/_}_${CACHE_NAME}
CACHE_PATH=${CACHE_BASE}/${CACHE_NAME}
mv ${REPOPATH} ${CACHE_PATH}
done