-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement raw disk image generation in go (#139)
* Implement raw disk image generation in go Drops the use of the script to generate it on pure golang Also drops some packages which are no longer needed from luet as we use the artifacts from the rootfs to support secureboot Signed-off-by: Itxaka <[email protected]> * Use source directly Aurora parses the source already and gives us a dir only Signed-off-by: Itxaka <[email protected]> * Pass only the output dir to the raw image generation Image name is generated formt he rootfs Signed-off-by: Itxaka <[email protected]> * Adress some comments - use a TempDir function to set/get the tmpdir - make all methods private - Fix the flavor/model get method to fallback to os-release Signed-off-by: Itxaka <[email protected]> * Use default constants for efi/oem partitions Signed-off-by: Itxaka <[email protected]> * Several improvements - fix gce and azure scripts, they were broken but alwasy exited with 0 so images generated were wrong (problems with parsing the image size) - improve the flavor/artifact name retrieval to be backwards compatible - simplify the call to gce/vhd transformation. It requires only the source dir where the raw image is and moves it witht he same name+new extension for easy identification - Fix and improve raw image tests. - More error catching and logging Signed-off-by: Itxaka <[email protected]> * Remove focus Signed-off-by: Itxaka <[email protected]> * Fix size not being parsed Signed-off-by: Itxaka <[email protected]> * Add tests for bootable raw image Signed-off-by: Itxaka <[email protected]> * Fix tests Signed-off-by: Itxaka <[email protected]> * Fix firmware path Signed-off-by: Itxaka <[email protected]> * Fix packages Signed-off-by: Itxaka <[email protected]> * test Signed-off-by: Itxaka <[email protected]> * Fix ovmf path Signed-off-by: Itxaka <[email protected]> * Fix Signed-off-by: Itxaka <[email protected]> * Run on kvm Signed-off-by: Itxaka <[email protected]> * Serial disk tests Signed-off-by: Itxaka <[email protected]> * Fix Signed-off-by: Itxaka <[email protected]> * Fix Signed-off-by: Itxaka <[email protected]> --------- Signed-off-by: Itxaka <[email protected]>
- Loading branch information
Showing
18 changed files
with
1,219 additions
and
389 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ jobs: | |
tags: auroraboot:latest | ||
- name: Run e2e tests | ||
run: | | ||
sudo go run github.com/onsi/ginkgo/v2/ginkgo -v -r -p --covermode=atomic --coverprofile=coverage.out --timeout=2h --label-filter "!bootable" ./e2e | ||
sudo go run github.com/onsi/ginkgo/v2/ginkgo -v -r -p --covermode=atomic --coverprofile=coverage.out --timeout=2h --label-filter "!bootable && !raw-bootable" ./e2e | ||
- name: Codecov | ||
uses: codecov/codecov-action@v5 | ||
env: | ||
|
@@ -78,3 +78,49 @@ jobs: | |
fetch-depth: 0 | ||
- name: Build | ||
run: earthly +test-bootable | ||
test-bootable-raw: | ||
runs-on: kvm | ||
steps: | ||
- uses: earthly/[email protected] | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install deps | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y ovmf libvirt-clients libvirt-daemon-system libvirt-daemon virtinst bridge-utils qemu-system-x86 qemu-system-x86 qemu-utils qemu-kvm acl udev | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@master | ||
- name: Build local image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: false | ||
load: true | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
tags: auroraboot:latest | ||
- name: Generate raw image | ||
run: | | ||
docker run --rm --privileged -v $PWD/build/:/output auroraboot:latest --debug --set "disable_http_server=true" --set "disable_netboot=true" --set "disk.raw=true" --set "disk.size=16000" --set "container_image=quay.io/kairos/ubuntu:24.04-core-amd64-generic-v3.2.3" --set "state_dir=/output" | ||
- name: Test raw image is bootable | ||
env: | ||
FIRMWARE: /usr/share/OVMF/OVMF_CODE.fd | ||
USE_QEMU: true | ||
MEMORY: 4000 | ||
CPUS: 2 | ||
CREATE_VM: true | ||
KVM: true | ||
run: | | ||
# TODO: permissions stuff should be fixed on aurora side, the output dir should contain only | ||
# there required output image/iso and not the leftovers from the build process | ||
sudo chmod -R 777 build | ||
#earthly +test-bootable-raw | ||
export RAW_IMAGE=$(find $PWD/build -name *.raw) | ||
go run github.com/onsi/ginkgo/v2/ginkgo run --label-filter "raw-bootable" -v --fail-fast -r ./e2e |
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
Binary file not shown.
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
Oops, something went wrong.