Skip to content

Commit

Permalink
WIP: podvm_mkosi: Create cloudinit enabled amd64 podvm image
Browse files Browse the repository at this point in the history
Try creating a new cloud-init enabled podvm image, as
libvirt e2e tests need this, but Azure doesn't

Once process-user-data can read from the cd-rom, this
should be able to be removed

Signed-off-by: stevenhorsman <[email protected]>
  • Loading branch information
stevenhorsman committed Dec 2, 2024
1 parent c92e88f commit d3b7d6c
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 6 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/e2e_run_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ jobs:
debug: true
secrets: inherit

podvm_mkosi_amd64_cloudinit:
uses: ./.github/workflows/podvm_mkosi.yaml
with:
registry: ${{ inputs.registry }}
image_tag: ${{ inputs.podvm_image_tag }}
git_ref: ${{ inputs.git_ref }}
arch: amd64
debug: true
cloud-init: true
secrets: inherit

podvm_mkosi_s390x:
uses: ./.github/workflows/podvm_mkosi.yaml
with:
Expand Down Expand Up @@ -247,15 +258,15 @@ jobs:
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.labels.*.name, 'test_e2e_libvirt') ||
contains(github.event.pull_request.labels.*.name, 'test_e2e_libvirt_amd64')
needs: [podvm_mkosi_amd64, libvirt_e2e_arch_prep, caa_image_amd64]
needs: [podvm_mkosi_amd64_cloudinit, libvirt_e2e_arch_prep, caa_image_amd64]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.libvirt_e2e_arch_prep.outputs.matrix) }}
uses: ./.github/workflows/e2e_libvirt.yaml
with:
runner: ubuntu-24.04
caa_image: ${{ inputs.registry }}/cloud-api-adaptor:${{ inputs.caa_image_tag }}-amd64-dev
podvm_image: ${{ needs.podvm_mkosi_amd64.outputs.qcow2_oras_image }}
podvm_image: ${{ needs.podvm_mkosi_amd64_cloudinit.outputs.qcow2_oras_image }}
install_directory_artifact: install_directory
git_ref: ${{ inputs.git_ref }}
oras: true
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/podvm_mkosi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ on:
default: false
required: false
type: boolean
cloud-init:
description: Whether to build the image with cloudinit enabled
default: false
required: false
type: boolean

workflow_call:
inputs:
Expand All @@ -50,6 +55,11 @@ on:
default: false
required: false
type: boolean
cloud-init:
description: Whether to build the image with cloudinit enabled
default: false
required: false
type: boolean
outputs:
qcow2_oras_image:
description: The location of the qcow2 oras container this workflow pushed
Expand Down Expand Up @@ -257,6 +267,8 @@ jobs:
echo "Making non-debug image"
make image
fi
env:
CLOUD_INIT: ${{ inputs.cloud-init == true && 'true' || 'false' }}

- name: Upload the qcow2 with oras
id: publish_oras_qcow2
Expand All @@ -270,6 +282,9 @@ jobs:
if [ "${{inputs.debug}}" = "true" ]; then
image=${image}-debug
fi
if [ "${{inputs.cloud-init}}" = "true" ]; then
image=${image}-cloudinit
fi
tag=${{ steps.image_tag.outputs.image_tag }}
arch_tag=${tag}_${{ inputs.arch }}
oras push "${image}:${arch_tag}" podvm.tar.xz
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/podvm_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [amd64, s390x]
images: [
{ amd64: x86_64, cloud-init: false },
{ arch: s390x, cloud-init: true }, # Note cloud-init is always used in s390x, so this setting it ignored
{ amd64: x86_64, cloud-init: true },
]
with:
git_ref: ${{ github.sha }}
image_tag: ${{ github.sha }}
arch: ${{ matrix.arch}}
arch: ${{ matrix.images.arch }}
cloud-init: ${{ matrix.images.cloud-init }}
debug: false
secrets: inherit
9 changes: 7 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,16 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [amd64, s390x]
images: [
{ amd64: x86_64, cloud-init: false },
{ arch: s390x, cloud-init: true }, # Note cloud-init is always used in s390x, so this setting it ignored
{ amd64: x86_64, cloud-init: true },
]
with:
image_tag: ${{ github.event.release.tag_name }}
git_ref: ${{ github.ref }}
arch: ${{ matrix.arch}}
arch: ${{ matrix.images.arch }}
cloud-init: ${{ matrix.images.cloud-init }}
debug: false
secrets: inherit

Expand Down
11 changes: 11 additions & 0 deletions src/cloud-api-adaptor/podvm-mkosi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PODVM_BINARIES_IMAGE ?= $(REGISTRY)/podvm-binaries-$(PODVM_DISTRO)-$(ARCH):$(POD
PODVM_IMAGE ?= $(REGISTRY)/podvm-generic-$(PODVM_DISTRO)$(if $(filter $(SE_BOOT),true),-se,)-$(ARCH):$(PODVM_TAG)
PODVM_CONTAINER_NAME ?= $(REGISTRY)/podvm-docker-image-$(ARCH)
VERIFY_PROVENANCE ?= no
CLOUD_INIT ?= false

PUSH ?= false
# If not pushing `--load` into the local docker cache
Expand Down Expand Up @@ -86,6 +87,11 @@ else ifeq ($(ARCH),s390x)
touch resources/buildS390xImage
sudo mkosi --profile production.conf --image system
sudo -E ../hack/build-s390x-image.sh
else ifeq ($(CLOUD_INIT),true)
touch resources/buildCloudInitImage
touch resources/buildBootableImage
sudo -E env PATH=$(PATH) nix develop ..#podvm-mkosi --command mkosi --environment=VARIANT_ID=production
qemu-img convert -f raw -O qcow2 build/system.raw build/podvm-amd64-cloudinit.qcow2
else
touch resources/buildBootableImage
sudo -E env PATH=$(PATH) nix develop ..#podvm-mkosi --command mkosi --environment=VARIANT_ID=production
Expand All @@ -107,6 +113,11 @@ else ifeq ($(ARCH),s390x)
touch resources/buildS390xImage
sudo mkosi --profile debug.conf
sudo -E ../hack/build-s390x-image.sh
else ifeq ($(CLOUD_INIT),true)
touch resources/buildCloudInitImage
touch resources/buildBootableImage
sudo -E env PATH=$(PATH) nix develop ..#podvm-mkosi --command mkosi --environment=VARIANT_ID=debug
qemu-img convert -f raw -O qcow2 build/system.raw build/podvm-amd64-cloudinit.qcow2
else
touch resources/buildBootableImage
sudo -E env PATH=$(PATH) nix develop ..#podvm-mkosi --command mkosi --environment=VARIANT_ID=debug
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Match]
Distribution=fedora

PathExists=../../resources/buildCloudInitImage

[Content]
Packages=cloud-init
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ enable afterburn-checkin.service
enable sshd.service
enable [email protected]
enable ssh-host-keys-migration.service

# For cloudinit
# This unit isn't part of the non-cloudinit image.
enable cloud-init.service

0 comments on commit d3b7d6c

Please sign in to comment.