Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test container before pushing to Docker registry #28

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Don't build separate container images for debos/fakemachine
Building separate container images for each project was a bit of a
premature optimisation which just made things more complicated. Instead
of building separate containers for debos/fakemachine, build one generic
container which may be used for either project.

Since this renames the container image names, debos/fakemachine will need
to be updated to use the new container images. No explicit dependency is
required in the downstream projects since the old containers will remain
in place as no deletion policy for these containers exists yet.

Signed-off-by: Christopher Obbard <[email protected]>
obbardc committed Nov 11, 2023
commit 5927f1884593dc55668bbe34734bab7bbec742f5
44 changes: 8 additions & 36 deletions .github/workflows/container.yaml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ env:
jobs:
build-containers:
runs-on: ubuntu-latest
name: Build ${{ matrix.variant }} containers
name: Build ${{ matrix.variant }} container
permissions:
contents: read
packages: write
@@ -51,57 +51,29 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Build Fakemachine containers
- name: Extract metadata (tags, labels) for Fakemachine Docker image
id: meta-fakemachine
- name: Extract metadata (tags, labels) for Docker image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/fakemachine-${{ matrix.variant }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.variant }}
tags: |
"type=ref,event=branch"
"type=ref,suffix=-{{sha}},event=branch"
"type=ref,suffix=-{{date 'YYYYMMDD'}},event=branch"
"type=ref,event=tag"
"type=ref,event=pr"
- name: Build and push Fakemachine Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.fakemachine-${{ matrix.dockerfile }}
file: Dockerfile.${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-fakemachine.outputs.tags }}
labels: ${{ steps.meta-fakemachine.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VARIANT=${{ matrix.variant }}
# Build Debos containers (based on Fakemachine container)
- name: Extract metadata (tags, labels) for Debos Docker image
id: meta-debos
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/debos-${{ matrix.variant }}
tags: |
"type=ref,event=branch"
"type=ref,suffix=-{{sha}},event=branch"
"type=ref,suffix=-{{date 'YYYYMMDD'}},event=branch"
"type=ref,event=tag"
"type=ref,event=pr"
- name: Build and push Debos Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.debos-${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-debos.outputs.tags }}
labels: ${{ steps.meta-debos.outputs.labels }}
build-args: |
VARIANT=${{ matrix.variant }}
BASE_REGISTRY=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
BASE_IMAGE=fakemachine-${{ matrix.variant }}
BASE_TAG=${{ steps.meta-fakemachine.outputs.version }}
# Job to key success status against
allgreen:
name: allgreen
8 changes: 8 additions & 0 deletions Dockerfile.fakemachine-arch → Dockerfile.arch
Original file line number Diff line number Diff line change
@@ -10,8 +10,16 @@ RUN pacman -Syu --noconfirm qemu-base \
--assume-installed initramfs \
&& find /var/cache/pacman/pkg -mindepth 1 -delete

# Bits needed to run debos
RUN pacman -Syu --noconfirm dpkg \
unzip \
&& find /var/cache/pacman/pkg -mindepth 1 -delete

# Bits needed to build fakemachine
RUN pacman -Syu --noconfirm go \
git \
&& find /var/cache/pacman/pkg -mindepth 1 -delete

# Bits needed to build debos
RUN pacman -Syu --noconfirm ostree \
&& find /var/cache/pacman/pkg -mindepth 1 -delete
10 changes: 10 additions & 0 deletions Dockerfile.fakemachine-debian → Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -23,6 +23,11 @@ RUN if [ "$VARIANT" != "bullseye" ] ; then \
apt-get install --no-install-recommends -y systemd-resolved; \
fi

# Bits needed to run debos
RUN apt-get update && \
apt-get install --no-install-recommends -y \
unzip

# Bits needed to build fakemachine
RUN apt-get update && \
apt-get install --no-install-recommends -y \
@@ -31,3 +36,8 @@ RUN apt-get update && \
ca-certificates \
gcc \
libc6-dev

# Bits needed to build debos
RUN apt-get update && \
apt-get install --no-install-recommends -y \
libostree-dev
13 changes: 0 additions & 13 deletions Dockerfile.debos-arch

This file was deleted.

18 changes: 0 additions & 18 deletions Dockerfile.debos-debian

This file was deleted.