-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fedora-41-builds
- Loading branch information
Showing
4 changed files
with
160 additions
and
13 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Rechunk Image | ||
|
||
inputs: | ||
builder: | ||
description: 'The name of the builder to use (docker or podman)' | ||
required: false | ||
default: 'podman' | ||
ref: | ||
description: 'The reference to the image to rechunk' | ||
required: true | ||
prev-ref: | ||
description: 'The reference to the previous image' | ||
required: false | ||
tags: | ||
description: 'The tags to apply to the rechunked image' | ||
required: false | ||
default: '' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Prepare Rechunk (Podman) | ||
if: ${{ inputs.builder == 'podman' }} | ||
shell: bash | ||
env: | ||
SOURCE_IMAGE: ${{ inputs.ref }} | ||
run: | | ||
set -euox pipefail | ||
sudo apt update && sudo apt install systemd-container | ||
podman image ls | ||
sudo podman image scp $(whoami)@localhost::${SOURCE_IMAGE} root@localhost:: | ||
sudo podman image ls | ||
podman rmi $(podman image ls -qa) --force | ||
- name: Prepare Rechunk (Docker) | ||
if: ${{ inputs.builder == 'docker' }} | ||
shell: bash | ||
env: | ||
SOURCE_IMAGE: ${{ inputs.ref }} | ||
run: | | ||
set -euox pipefail | ||
docker save $(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep ${SOURCE_IMAGE}) | sudo podman load | ||
sudo podman image ls | ||
docker rmi $(docker image ls -qa) --force | ||
- name: Rechunk Image | ||
id: rechunk | ||
uses: hhd-dev/[email protected] | ||
with: | ||
rechunk: ghcr.io/hhd-dev/rechunk:v0.8.6 | ||
ref: ${{ inputs.ref }} | ||
skip_compression: true | ||
prev-ref: ${{ inputs.prev-ref }} | ||
|
||
- name: Load Rechunked Image (Podman) | ||
if: ${{ inputs.builder == 'podman' }} | ||
shell: bash | ||
run: | | ||
sudo podman rmi $(sudo podman image ls -qa) --force | ||
IMAGE=$(podman pull ${{ steps.rechunk.outputs.ref }}) | ||
tags="${{ inputs.tags }}" | ||
sudo rm -rf ${{ steps.rechunk.outputs.location }} | ||
IFS=' ' read -r -a tag_array <<< "$tags" | ||
for tag in "${tag_array[@]}"; do | ||
podman tag $IMAGE ${{ env.IMAGE_NAME }}:${tag} | ||
done | ||
podman image ls | ||
- name: Load Rechunked Image (Docker) | ||
if: ${{ inputs.builder == 'docker' }} | ||
shell: bash | ||
run: | | ||
set -euox pipefail | ||
sudo podman rmi $(sudo podman image ls -qa) --force | ||
IMAGE="temporary-image:latest" | ||
sudo skopeo copy ${{ steps.rechunk.outputs.ref }} docker-daemon:${IMAGE} | ||
tags="${{ inputs.tags }}" | ||
sudo rm -rf ${{ steps.rechunk.outputs.location }} | ||
IFS=' ' read -r -a tag_array <<< "$tags" | ||
for tag in "${tag_array[@]}"; do | ||
docker tag $IMAGE ${{ env.IMAGE_NAME }}:${tag} | ||
done | ||
docker image ls |
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