@@ -134,41 +134,37 @@ jobs:
134
134
image_id="$( cat "${iidfile}" )"
135
135
rm "${iidfile}"
136
136
137
- # Extract various package info and version info, then store that info as labels
137
+ # Extract various package info and version info, then store that info
138
+ # as labels. Container is removed at the end to avoid e.g. having these
139
+ # commands in the history of the container.
138
140
container="$( buildah from "${image_id}" )"
139
141
run() { buildah run "${container}" "${@}" ; }
140
- deb_list="$( run cat /.deb.lst | tr '\n' '|' | sed 's/|$//' )"
141
- pkg_list="$( run cat /.pkg.lst | tr '\n' '|' | sed 's/|$//' )"
142
- glibc="$( run sh -c 'exec "$( find -xdev -name libc.so.6 -print -quit )"' | sed '1!d' )"
143
- debian="$( run cat /etc/debian_version | sed '1!d' )"
144
- bash="$( run bash --version | sed '1!d' )"
142
+ LABELS=()
143
+ LABELS+=("--label=deb-list=\"$( run cat /.deb.lst | tr '\n' '|' | sed 's/|$//' )\"")
144
+ LABELS+=("--label=pkg-list=\"$( run cat /.pkg.lst | tr '\n' '|' | sed 's/|$//' )\"")
145
+ LABELS+=("--label=glibc=\"$( run sh -c 'exec "$( find -xdev -name libc.so.6 -print -quit )"' | sed '1!d' )\"")
146
+ LABELS+=("--label=debian=\"$( run cat /etc/debian_version | sed '1!d' )\"")
147
+ LABELS+=("--label=bash=\"$( run bash --version | sed '1!d' )\"")
145
148
146
149
if [ "${bioconda_utils}" ]; then
147
150
bioconda_utils="$(
148
151
run sh -c '. /opt/conda/etc/profile.d/conda.sh && conda activate base && bioconda-utils --version' \
149
152
| rev | cut -f1 -d " " | rev
150
153
)"
151
- buildah config --label=bioconda-utils= "${bioconda_utils}" ${container}
154
+ LABELS+=(" --label=\ "${bioconda_utils}\"")
152
155
fi
153
156
154
157
if [ ! -z "${busybox_version}" ]; then
155
- buildah config --label=busybox-version="${busybox_version}"
158
+ LABELS+=(" --label=busybox-version=\ "${busybox_version}\"")
156
159
fi
157
160
buildah rm "${container}"
158
161
159
- # TODO: use array for labels, and make sure this next container is
160
- # the one getting the labels (above, bioconda-utils is added to the
161
- # first container which is then rmed)
162
+ # Add labels to a new container...
162
163
container="$( buildah from "${image_id}" )"
163
- buildah config \
164
- --label=glibc="${glibc}" \
165
- --label=debian="${debian}" \
166
- --label=bash="${bash}" \
167
- --label=deb-list="${deb_list}" \
168
- --label=pkg-list="${pkg_list}" \
169
- "${container}"
170
-
171
- # Store the new image (now with labels)
164
+ buildah config ${LABELS[@]} "${container}"
165
+
166
+ # ...then store the container (now with labels) as a new image. This
167
+ # is what we'll use to upload.
172
168
image_id="$( buildah commit "${container}" )"
173
169
buildah rm "${container}"
174
170
0 commit comments