Skip to content

Commit 2b99792

Browse files
paperbennibenjamin
andauthored
feat: migrate images from bioconda-containers (#1109)
Migrate images from bioconda-containers to bioconda-utils to bring new bioconda-utils master more in line with #1049 #1049 migrates images from bioconda/bioconda-containers to bioconda/bioconda-utils. Containers have been updated in bioconda-containers since, so this contains the new versions of bioconda-containers. After this is merged, bioconda-containers should be archived the env vars whose names #1049 changed were not used in any repo in bioconda since the containers and #1049 contain a lot of untested bash code, I added bash linting and formatting and fixed some minor issues the linter found images from bioconda-containers have not been updated or built in a long time, hence some fixes to things which broke in the meantime - mamba errs out, switched to conda - busybox cgit went down, switched to official GH mirror linked on busybox.net - switched to skopeo from quay REST api to circumvent strict quay REST rate limits - fix broken version parsing regex not liking new format --------- Co-authored-by: benjamin <benjamin@stiffcoyote-e9263.denbi.prod>
1 parent 04cd7d0 commit 2b99792

45 files changed

Lines changed: 4771 additions & 41 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
name: 'Build & Push: base-glibc-busybox-bash'
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths:
7+
- images/base-glibc-busybox-bash/*
8+
- .github/workflows/base-glibc-busybox-bash.yaml
9+
pull_request:
10+
paths:
11+
- images/base-glibc-busybox-bash/*
12+
- .github/workflows/base-glibc-busybox-bash.yaml
13+
14+
jobs:
15+
build:
16+
name: Build & Push
17+
runs-on: ubuntu-24.04
18+
container:
19+
# travier/podman-action contains newer podman/buildah versions.
20+
image: quay.io/travier/podman-action
21+
options: --privileged
22+
env:
23+
# The base image is not intended to change often and should be used with
24+
# version tags or checksum IDs, but not via "latest".
25+
MAJOR_VERSION: 3
26+
MINOR_VERSION: 1
27+
IMAGE_NAME: base-glibc-busybox-bash
28+
BUSYBOX_VERSION: '1.36.1'
29+
DEBIAN_VERSION: '12.5'
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Set up QEMU
35+
run: |
36+
podman run --rm --privileged \
37+
docker.io/tonistiigi/binfmt --install arm64
38+
39+
- name: Install Tools
40+
run: |
41+
set -eu
42+
# jq is not installed in travier/podman-action
43+
dnf install -qy \
44+
jq
45+
rpm -q \
46+
buildah podman \
47+
coreutils findutils sed \
48+
curl jq \
49+
| (
50+
while read -r line ; do
51+
printf %s\\n "${line}"
52+
case "${line}" in (*' not installed'*)
53+
err=1 ;;
54+
esac
55+
done
56+
exit "${err-0}"
57+
)
58+
59+
- name: Build
60+
id: build
61+
run: |
62+
set -xeu
63+
cd 'images/${{ env.IMAGE_NAME }}'
64+
65+
image_name='${{ env.IMAGE_NAME }}'
66+
tags='
67+
${{ env.MAJOR_VERSION }}
68+
${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
69+
latest
70+
'
71+
printf %s\\n \
72+
"image=${image_name}" \
73+
"tags=$( echo ${tags} )" \
74+
>> $GITHUB_OUTPUT
75+
76+
for tag in ${tags} ; do
77+
buildah manifest create "${image_name}:${tag}"
78+
done
79+
80+
iidfile="$( mktemp )"
81+
buildah bud \
82+
--iidfile="${iidfile}" \
83+
--build-arg=busybox_version='${{ env.BUSYBOX_VERSION }}' \
84+
--file=Dockerfile.busybox
85+
busybox_image="$( cat "${iidfile}" )"
86+
rm "${iidfile}"
87+
88+
for arch in amd64 arm64 ; do
89+
iidfile="$( mktemp )"
90+
buildah bud \
91+
--arch="${arch}" \
92+
--iidfile="${iidfile}" \
93+
--build-arg=busybox_image="${busybox_image}" \
94+
--build-arg=debian_version='${{ env.DEBIAN_VERSION }}'
95+
image_id="$( cat "${iidfile}" )"
96+
rm "${iidfile}"
97+
98+
container="$( buildah from "${image_id}" )"
99+
run() { buildah run "${container}" "${@}" ; }
100+
deb_list="$( run cat /.deb.lst | tr '\n' '|' | sed 's/|$//' )"
101+
pkg_list="$( run cat /.pkg.lst | tr '\n' '|' | sed 's/|$//' )"
102+
glibc="$( run sh -c 'exec "$( find -xdev -name libc.so.6 -print -quit )"' | sed '1!d' )"
103+
busybox="$( run busybox | sed '1!d' )"
104+
bash="$( run bash --version | sed '1!d' )"
105+
buildah rm "${container}"
106+
107+
container="$( buildah from "${image_id}" )"
108+
buildah config \
109+
--label=glibc="${glibc}" \
110+
--label=busybox="${busybox}" \
111+
--label=bash="${bash}" \
112+
--label=deb-list="${deb_list}" \
113+
--label=pkg-list="${pkg_list}" \
114+
"${container}"
115+
116+
image_id="$( buildah commit "${container}" )"
117+
buildah rm "${container}"
118+
for tag in ${tags} ; do
119+
buildah tag \
120+
"${image_id}" \
121+
"${image_name}:${tag}-${arch}"
122+
buildah manifest add \
123+
"${image_name}:${tag}" \
124+
"${image_id}"
125+
done
126+
done
127+
128+
- name: Test
129+
run: |
130+
image='${{ steps.build.outputs.image }}'
131+
ids="$(
132+
for tag in ${{ steps.build.outputs.tags }} ; do
133+
buildah manifest inspect "${image}:${tag}" \
134+
| jq -r '.manifests[]|.digest' \
135+
| while read id ; do
136+
buildah images --format '{{.ID}}{{.Digest}}' \
137+
| sed -n "s/${id}//p"
138+
done
139+
done
140+
)"
141+
ids="$( printf %s "${ids}" | sort -u )"
142+
for id in ${ids} ; do
143+
podman history "${id}"
144+
buildah bud \
145+
--build-arg=base="${id}" \
146+
--file=Dockerfile.test \
147+
"images/${image}"
148+
done
149+
buildah rmi --prune || true
150+
151+
- if: ${{ github.ref == 'refs/heads/master' }}
152+
name: Check Tags
153+
run: |
154+
# Quay.io does not support immutable images.
155+
# => Check for duplicate tags to avoid overwriting existing images.
156+
existing_tags="$(
157+
skopeo list-tags docker://quay.io/bioconda/${{ steps.build.outputs.image }} \
158+
| jq -r '.Tags[]'
159+
)" \
160+
|| {
161+
echo 'Could not list tags via skopeo.'
162+
exit 1
163+
}
164+
for tag in ${{ steps.build.outputs.tags }} ; do
165+
case "${tag}" in
166+
latest | '${{ env.MAJOR_VERSION }}' ) ;;
167+
* )
168+
if printf %s "${existing_tags}" | grep -qxF "${tag}" ; then
169+
printf 'Tag %s already exists!\n' "${tag}"
170+
exit 1
171+
fi
172+
esac
173+
done
174+
175+
- if: ${{ github.ref == 'refs/heads/master' }}
176+
name: Push
177+
uses: redhat-actions/push-to-registry@v2
178+
with:
179+
image: ${{ steps.build.outputs.image }}
180+
tags: ${{ steps.build.outputs.tags }}
181+
registry: ${{ secrets.QUAY_BIOCONDA_REPO }}
182+
username: ${{ secrets.QUAY_BIOCONDA_USERNAME }}
183+
password: ${{ secrets.QUAY_BIOCONDA_TOKEN }}
184+
185+
- if: ${{ github.ref == 'refs/heads/master' }}
186+
name: Test Pushed
187+
run: |
188+
image='${{ env.IMAGE_NAME }}'
189+
ids="$(
190+
for tag in ${{ steps.build.outputs.tags }} ; do
191+
buildah manifest inspect "${image}:${tag}" \
192+
| jq -r '.manifests[]|.digest' \
193+
| while read id ; do
194+
buildah images --format '{{.ID}}{{.Digest}}' \
195+
| sed -n "s/${id}//p"
196+
done
197+
done
198+
)"
199+
ids="$( printf %s "${ids}" | sort -u )"
200+
for id in ${ids} ; do
201+
podman history "${id}"
202+
buildah bud \
203+
--build-arg=base="${id}" \
204+
--file=Dockerfile.test \
205+
"images/${image}"
206+
done
207+
buildah rmi --prune || true

0 commit comments

Comments
 (0)