Skip to content

Commit

Permalink
build bare
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilhe committed Oct 28, 2024
1 parent 5732085 commit f47d1c7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
28 changes: 10 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,6 @@ jobs:
echo "Tags: ${{ steps.build_image.outputs.tags }}"
echo "Tagged Image: ${{ steps.build_image.outputs.image-with-tag }}"
- run: |
podman save --format oci-archive ${{ steps.build_image.outputs.image }}:${{ env.IMAGE_TAG }} > glvd.oci
podman pull ghcr.io/gardenlinux/gardenlinux:1592
podman save --format oci-archive ghcr.io/gardenlinux/gardenlinux:1592 > gardenlinux.oci
./unbase_oci --exclude exclude --include include --ldd-dependencies --print-tree gardenlinux.oci glvd.oci glvd_bare.oci
image="$(podman load < glvd_bare.oci | awk '{ print $NF }')"
podman tag "$image" ${{ steps.build_image.outputs.image }}:${{ env.IMAGE_TAG }}_bare
- name: Check images created
run: buildah images | grep '${{ env.IMAGE_NAME }}'

Expand All @@ -121,16 +110,19 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push To ghcr.io
id: push-to-ghcr-bare
if: ${{ github.event_name != 'pull_request' }}
uses: redhat-actions/push-to-registry@v2
- name: Log in to ghcr.io
uses: redhat-actions/podman-login@v1
with:
image: ${{ steps.build_image.outputs.image }}
tags: latest_bare
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io

- name: Build bare images
if: ${{ github.event_name != 'pull_request' }}
run: |
./build_bare.sh
podman push ghcr.io/gardenlinux/glvd-api:latest-linuxamd64_bare
podman push ghcr.io/gardenlinux/glvd-api:latest-linuxarm64_bare
- name: Print image url
if: ${{ github.event_name != 'pull_request' }}
Expand Down
22 changes: 22 additions & 0 deletions build_bare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

GLVD_API_IMAGE_REPOSITORY=ghcr.io/gardenlinux/glvd-api
GLVD_API_IMAGE_TAG=latest

build () {
local ARCH="${1}"; shift

SHA_GLVD=$(podman pull -q --arch="$ARCH" $GLVD_API_IMAGE_REPOSITORY:$GLVD_API_IMAGE_TAG)
podman save --format oci-archive "$SHA_GLVD" > glvd-"$ARCH".oci

SHA_GL=$(podman pull -q --arch="$ARCH" ghcr.io/gardenlinux/gardenlinux:1592)
podman save --format oci-archive "$SHA_GL" > gardenlinux-"$ARCH".oci

./unbase_oci --exclude exclude --include include --ldd-dependencies --print-tree gardenlinux-"$ARCH".oci glvd-"$ARCH".oci glvd_bare-"$ARCH".oci

image="$(podman load < glvd_bare-"$ARCH".oci | awk '{ print $NF }')"
podman tag "$image" $GLVD_API_IMAGE_REPOSITORY:$GLVD_API_IMAGE_TAG-linux"$ARCH"_bare
}

build amd64
build arm64

0 comments on commit f47d1c7

Please sign in to comment.