Build and push disk images #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
mkdir output | |
mkdir 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 | |
ls -l $ARTIFACT | |
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 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 | |
echo ' ]' >> index.json | |
echo '}' >> index.json | |
cat index.json | |
oras manifest push $URL:latest index.json |