Skip to content

Build and push disk images #24

Build and push disk images

Build and push disk images #24

Workflow file for this run

name: "Build and push bootc disk images"
on:
workflow_dispatch:
pull_request:
env:
REGISTRY: quay.io
REPOSITORY: flightctl
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [rhel]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install podman
run: sudo apt install podman
- name: Build and push disk images
run: |
set -x
mkdir output
mkdir output/image
URL=${{ env.REGISTRY }}/${{ env.REPOSITORY}}/flightctl-agent-${{ matrix.flavor }}
oras login -u "${{ secrets.QUAY_FLIGHTCTL_INFRA_ROBOT_USERNAME }}" -p "${{ secrets.QUAY_FLIGHTCTL_INFRA_ROBOT_PASSWORD }}" "${{ env.REGISTRY }}"
oras blob push $URL .github/workflow-scripts/empty.json
cp .github/workflow-scripts/index.json-head index.json
export SIZE
export SHA
export ARCH
export FORMAT
for ARCH in amd64 arm64; do
for FORMAT in qcow2 raw; do
#sudo podman run --rm \
# -it \
# --privileged \
# --pull=newer \
# --security-opt label=type:unconfined_t \
# -v $(pwd)/output:/output \
# -v /var/lib/containers/storage:/var/lib/containers/storage \
# quay.io/centos-bootc/bootc-image-builder:latest \
# --type $FORMAT \
# --target-arch $ARCH \
# "$URL:bootstrap"
echo $ARCH-$FORMAT > output/image/disk.raw
if [ -f output/image/disk.raw ]; then
ARTIFACT=output/image/disk.raw
else
ARTIFACT=output/qcow2/disk.qcow2
fi
oras blob push "$URL" $ARTIFACT
SHA="sha256:"$(sha256sum $ARTIFACT | awk '{print $1}')
SIZE=$(cat $ARTIFACT | wc -c)
cat .github/workflow-scripts/manifest.json.tmpl | envsubst > manifest.json
cat manifest.json
oras manifest push $URL:tmp manifest.json
SHA=$(sha256sum manifest.json | awk '{print $1}')
SIZE=$(cat manifest.json | wc -c)
cat .github/workflow-scripts/manifests.tmpl | envsubst >> index.json
cat index.json
done
done
truncate -s -2 index.json
echo ' ]' >> index.json
echo '}' >> index.json
cat index.json
oras manifest push $URL:latest index.json