Github Action fix? #261
This file contains hidden or 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 custom toolbox image | |
| on: | |
| push: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: '1 3 */14 * *' | |
| workflow_dispatch: {} | |
| env: | |
| REGISTRY_USER: aleskandrox | |
| IMAGE_REGISTRY: quay.io | |
| IMAGE_NAME: fedora | |
| REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} | |
| jobs: | |
| build-toolbox-image: | |
| runs-on: ubuntu-latest | |
| name: Build and Push Fedora toolbox image | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Buildah configuration | |
| run: | | |
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| conf=/etc/containers/storage.conf | |
| target=/mnt/containers/storage | |
| sudo mkdir -p "$target" | |
| sudo chown -R "$(id -u):$(id -g)" /mnt | |
| sudo awk -v g="$target" ' | |
| BEGIN { s=0 } | |
| /^\[storage\]/ { s=1; print; next } | |
| s && /^graphroot/ { print "graphroot = \"" g "\""; s=0; next } | |
| s && /^driver/ { print "driver = \"overlay\""; next } | |
| s && /^runroot/ { print "runroot = \"/run/containers/storage\""; next } | |
| { print } | |
| END { | |
| if (!s) next | |
| if (!seen) { | |
| print "driver = \"overlay\"" | |
| print "runroot = \"/run/containers/storage\"" | |
| print "graphroot = \"" g "\"" | |
| } | |
| } | |
| ' "$conf" 2>/dev/null | sudo tee "$conf" >/dev/null || sudo tee "$conf" >/dev/null <<EOF | |
| [storage] | |
| driver = "overlay" | |
| runroot = "/run/containers/storage" | |
| graphroot = "$target" | |
| EOF | |
| cat $conf | |
| - name: Set versioned tag | |
| id: versioned-tag | |
| run: | | |
| VERSIONED_TAG=$(date -u --iso-8601=minutes | sed 's/://g;s/+.*$//')-${GITHUB_SHA} | |
| echo "VERSIONED_TAG=${VERSIONED_TAG}" >> $GITHUB_OUTPUT | |
| - name: Build image | |
| uses: redhat-actions/buildah-build@v2 | |
| id: build-image | |
| with: | |
| image: ${{ env.IMAGE_REGISTRY }}/${{ env.REGISTRY_USER }}/${{ env.IMAGE_NAME }} | |
| oci: true | |
| layers: true | |
| tags: toolbox toolbox-custom-${{ steps.versioned-tag.outputs.VERSIONED_TAG }} | |
| containerfiles: | | |
| ./os_toolbox.Containerfile | |
| build-args: | | |
| BASE_REPO=quay.io/fedora/fedora-toolbox | |
| BASE_TAG=latest | |
| - name: Push to registry | |
| uses: redhat-actions/push-to-registry@v2 | |
| with: | |
| tags: >- | |
| ${{ env.IMAGE_REGISTRY }}/${{ env.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:toolbox | |
| ${{ env.IMAGE_REGISTRY }}/${{ env.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:toolbox-custom-${{ steps.versioned-tag.outputs.VERSIONED_TAG }} | |
| username: ${{ env.REGISTRY_USER }} | |
| password: ${{ secrets.REGISTRY_PASSWORD }} | |