build-extensions-container: various cleanups
Add more context about how the script is run.
Use `shift` on the same line we read arguments for consistency with the
rest of the codebase.
Factor out `localhost/extensions-container` into a variable.
Instead of `cd`ing into the config dir, pass it as the context dir
directly to podman.
#!/bin/bash
-#Used by cmd/build-extensions-container.go
-#Find the RHCOS ociarchive.
set -euo pipefail
-arch=$1
-shift
-filename=$1
-shift
-buildid=$1
-shift
-builddir="$PWD/builds/latest/${arch}"
+
+# Used by cmd/build-extensions-container.go. Runs via `runvm` via `cosash.go`.
+
+arch=$1; shift
+filename=$1; shift
+buildid=$1; shift
+
+workdir=$PWD
+builddir="${workdir}/builds/latest/${arch}"
ostree_ociarchive=$(ls "${builddir}"/*-ostree*.ociarchive)
+
# Build the image, replacing the FROM directive with the local image we have
-(cd src/config
- set -x
- podman build --from oci-archive:"$ostree_ociarchive" --network=host --build-arg COSA=true --label version="$buildid" -t localhost/extensions-container -f extensions/Dockerfile .
-)
+img=localhost/extensions-container
+(set -x; podman build --from oci-archive:"$ostree_ociarchive" --network=host \
+ --build-arg COSA=true --label version="$buildid" \
+ -t "${img}" -f extensions/Dockerfile "${workdir}/src/config")
+
# Call skopeo to export it from the container storage to an oci-archive.
-(set -x
- skopeo copy containers-storage:localhost/extensions-container oci-archive:"$filename" )
+(set -x; skopeo copy "containers-storage:${img}" oci-archive:"$filename")
