Skip to content

Commit

Permalink
label fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
daler committed Feb 2, 2024
1 parent 2321455 commit 5989f1b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/bioconda-utils-build-env-cos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ jobs:
tags: '3.1 3 latest'
debian_version: '12.2'
archs: 'arm64 amd64'
bioconda_utils: 'master'
44 changes: 25 additions & 19 deletions .github/workflows/generic_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
debian_version='${{ inputs.debian_version }}'
busybox_version='${{ inputs.busybox_version }}'
archs='${{ inputs.archs }}'
bioconda_utils='${{ inputs.bioconda_utils }}'
# Adds image and tags to outputs which can be used in later steps.
printf %s\\n \
Expand All @@ -80,7 +81,7 @@ jobs:
BUILD_ARGS+="--build-arg=debian_version=$debian_version"
fi
if [ '${{ inputs.bioconda_utils }}' ]; then
if [ ! -z "${bioconda_utils}" ]; then
# Due to different nomenclature used by conda-forge and buildah, we
# need to map archs to base images.
archs_and_images='
Expand All @@ -93,7 +94,10 @@ jobs:
if [ ! -z "${busybox_version}" ]; then
BUILD_ARGS+="--build-arg=busybox_version=$busybox_version"
# Make a busybox image that we'll use further below.
# Make a busybox image that we'll use further below. As shown in the
# Dockerfile.busybox, this uses the build-busybox script which in turn
# cross-compiles for x86_64 and aarch64, and these are later copied
# into an arch-specific container.
# --iidfile prints the built image ID to the specified file so we can
# refer to the image later
iidfile="$( mktemp )"
Expand Down Expand Up @@ -128,38 +132,37 @@ jobs:
image_id="$( cat "${iidfile}" )"
rm "${iidfile}"
# Extract various package info and version info...
# Extract various package info and version info, then store that info as labels
container="$( buildah from "${image_id}" )"
run() { buildah run "${container}" "${@}" ; }
# Incrementally make labels
deb_list="$( run cat /.deb.lst | tr '\n' '|' | sed 's/|$//' )"
pkg_list="$( run cat /.pkg.lst | tr '\n' '|' | sed 's/|$//' )"
glibc="$( run sh -c 'exec "$( find -xdev -name libc.so.6 -print -quit )"' | sed '1!d' )"
debian="$( run cat /etc/debian_version | sed '1!d' )"
bash="$( run bash --version | sed '1!d' )"
buildah rm "${container}"
LABELS=""
LABELS+="--label=deb-list=${deb_list} "
LABELS+="--label=pkg-list=${pkg_list} "
LABELS+="--label=glibc=${glibc} "
LABELS+="--label=debian=${debian} "
LABELS+="--label=bash=${bash} "
if [ '${{ inputs.bioconda_utils }}' ]; then
if [ ! -z "${bioconda_utils}" ]; then
bioconda_utils="$(
run sh -c '. /opt/conda/etc/profile.d/conda.sh && conda activate base && bioconda-utils --version' \
| rev | cut -f1 -d " " | rev
)"
LABELS+="--label=bioconda-utils=${bioconda_utils} "
buildah config --label=bioconda-utils="${bioconda_utils}" ${container}
fi
# ...then store that info as labels for the image
if [ ! -z "${busybox_version}" ]; then
buildah config --label=busybox-version="${busybox_version}"
fi
buildah rm "${container}"
container="$( buildah from "${image_id}" )"
buildah config $LABELS "${container}"
buildah config \
--label=glibc="${glibc}" \
--label=debian="${debian}" \
--label=bash="${bash}" \
--label=deb-list="${deb_list}" \
--label=pkg-list="${pkg_list}" \
"${container}"
# Store the new image (now with labels)
image_id="$( buildah commit "${container}" )"
Expand All @@ -173,8 +176,11 @@ jobs:
buildah manifest add \
"${image_name}:${tag}" \
"${image_id}"
buildah inspect -t image ${image_name}:${tag}
done
done
buidah_inspect -t manifest ${image_name}
- name: Test
run: |
Expand Down

0 comments on commit 5989f1b

Please sign in to comment.