Skip to content

Commit

Permalink
Merge pull request #76 from prydom/switch-to-podman
Browse files Browse the repository at this point in the history
Switch to the podman drivers for the bluebuild build
  • Loading branch information
prydom authored Oct 3, 2024
2 parents f07c513 + e729f2b commit 46eaf28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 56 deletions.
61 changes: 6 additions & 55 deletions .github/actions/bluebuild/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inputs:
Whether to run the unwanted software remover to maximize build space in the GitHub builder.
Disable this with 'false' if your image doesn't take up a lot of space and you'd rather have shorter build times.
required: false
default: 'true'
default: 'false'
use_unstable_cli:
description: |
If true, this action pulls the `main` branch of blue-build/cli instead of the stable version the current action version is configured to use by default.
Expand All @@ -59,19 +59,6 @@ inputs:
Example: `ublue-os`
required: false
default: ${{ github.repository_owner }}
use_cache:
description: |
Make use of docker buildx cache. This is an experimental feature of docker buildx
so it isn't guaranteed to work.
Input must match the string 'true' for the step to be enabled.
required: false
default: 'true'
squash:
description: |
Uses buildah to squash the build's layers into a single layer. Use of this option
disables cache.
required: false
default: 'false'
working_directory:
description: |
Changes working directory for whole build.
Expand All @@ -83,34 +70,11 @@ runs:
using: "composite"
steps:
# building custom images might take a lot of space,
# so it's best to remove unneeded softawre
# so it's best to remove unneeded software
- name: Maximize build space
uses: jlumbroso/[email protected]
if: ${{ inputs.maximize_build_space == 'true' }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: ${{ inputs.squash != 'true' }}
with:
install: true
driver: docker-container
cache-binary: ${{ inputs.use_cache }}

# Installs the latest version of Podman
# that is compatible with BlueBuild
- name: Setup Podman
if: ${{ inputs.squash == 'true' }}
shell: bash
run: |
# from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04
ubuntu_version='22.04'
key_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key"
sources_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}"
echo "deb $sources_url/ /" | sudo tee /etc/apt/sources.list.d/devel-kubic-libcontainers-unstable.list
curl -fsSL $key_url | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt-get update
sudo apt-get install -y podman
- uses: sigstore/[email protected]

# clones user's repo
Expand Down Expand Up @@ -144,20 +108,13 @@ runs:
env:
CLI_VERSION_TAG: ${{ steps.build_vars.outputs.cli_version }}
run: |
docker create \
podman create \
--name blue-build-installer \
ghcr.io/blue-build/cli${{ env.CLI_VERSION_TAG }}
docker cp blue-build-installer:/out/bluebuild /usr/local/bin/bluebuild
docker rm blue-build-installer
podman cp blue-build-installer:/out/bluebuild /usr/local/bin/bluebuild
podman rm blue-build-installer
bluebuild --version
# Required in order for docker buildx to
# take advantage of the GHA cache API
- name: Expose GitHub Runtime
if: ${{ inputs.use_cache == 'true' && inputs.squash != 'true' }}
uses: crazy-max/ghaction-github-runtime@v3


# blue-build/cli does the heavy lifting
- name: Build Image
shell: bash
Expand All @@ -170,15 +127,9 @@ runs:
BB_REGISTRY: ${{ inputs.registry }}
BB_REGISTRY_NAMESPACE: ${{ inputs.registry_namespace }}
GH_PR_EVENT_NUMBER: ${{ inputs.pr_event_number }}
BB_BUILDKIT_CACHE_GHA: ${{ inputs.use_cache }}
RECIPE_PATH: ${{ steps.build_vars.outputs.recipe_path }}
RUST_LOG_STYLE: always
CLICOLOR_FORCE: '1'
run: |
BUILD_OPTS="--compression-format gzip"
if [ "${{ inputs.squash }}" = "true" ]; then
BUILD_OPTS="--build-driver podman --squash $BUILD_OPTS"
fi
BUILD_OPTS="--compression-format gzip --build-driver podman --run-driver podman"
bluebuild build -v --push ${BUILD_OPTS} ${RECIPE_PATH}
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
recipe:
# !! Add your recipes here
- fedora-kinoite-laptop.yml
container:
image: ghcr.io/prydom/ostree-buildroot:rawhide
options: --privileged
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand All @@ -39,7 +42,7 @@ jobs:
registry_token: ${{ github.token }}
pr_event_number: ${{ github.event.number }}
use_unstable_cli: true
cli_version: ":20d1950530218118c6c0fff1fe5ff6b37e5d1586-installer"
cli_version: ":v0.8.18-installer"
rpm-ostree-rechunk:
name: rpm-ostree re-encapsulate
runs-on: ubuntu-latest
Expand Down

0 comments on commit 46eaf28

Please sign in to comment.