-
Notifications
You must be signed in to change notification settings - Fork 7
Add OSModifier vmtests into github workflow #363
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
6ae17fb
updates
elainezhao1 6f4dd9d
updates
elainezhao1 6331f0a
Merge branch 'main' into user/elaine/add-emu-test-in-workflows
elainezhao1 63263cd
updates
elainezhao1 e656f35
Merge branch 'user/elaine/add-emu-test-in-workflows' of github.com:mi…
elainezhao1 af9ee00
Merge branch 'main' into user/elaine/add-emu-test-in-workflows
elainezhao1 87565c1
temporarily set run test true
elainezhao1 b86250b
updates
elainezhao1 cd5c528
updates
elainezhao1 c072cd1
updates
elainezhao1 7b02a7c
Merge branch 'main' into user/elaine/add-emu-test-in-workflows
elainezhao1 b3f2f20
updates
elainezhao1 f0e373d
Merge branch 'user/elaine/add-emu-test-in-workflows' of github.com:mi…
elainezhao1 d742c18
updates
elainezhao1 f84de23
updates
elainezhao1 c259f04
updates
elainezhao1 2674087
updates
elainezhao1 cf4f87d
updates
elainezhao1 4a1d77b
updates
elainezhao1 831dd13
updates
elainezhao1 1677f3d
updates
elainezhao1 5263316
updates
elainezhao1 174d890
updates
elainezhao1 79fd38e
updates
elainezhao1 9696406
updates
elainezhao1 3698bed
Merge branch 'main' into user/elaine/add-emu-test-in-workflows
elainezhao1 d319cec
updates
elainezhao1 c74f94e
Merge branch 'user/elaine/add-emu-test-in-workflows' of github.com:mi…
elainezhao1 4baf362
updates
elainezhao1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,124 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
name: Tests VMTests suite for OSModifier | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
hostArch: | ||
required: true | ||
type: string | ||
hostDistro: | ||
required: true | ||
type: string | ||
inputImage: | ||
description: "Path to the base OS image accessible on the runner" | ||
required: true | ||
type: string | ||
|
||
env: | ||
EXPECTED_GO_VERSION: "1.24.1" | ||
IMAGE_CUSTOMIZER_CONTAINER_TAG: "imagecustomizer:dev" | ||
|
||
jobs: | ||
tests-osmodifier: | ||
name: Tests OSModifier suite | ||
runs-on: | ||
- self-hosted | ||
- 1ES.Pool=${{ inputs.hostDistro == 'azl3' && (inputs.hostArch == 'amd64' && 'maritimus-github-runner-azl3-amd64' || 'maritimus-github-runner-azl3-arm64') || (inputs.hostArch == 'amd64' && 'maritimus-github-runner-ubuntu2404-amd64' || 'maritimus-github-runner-ubuntu2404-arm64') }} | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Setup Go toolchain | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "${{ env.EXPECTED_GO_VERSION }}" | ||
|
||
- name: Install prerequisites (AZL3) | ||
if: inputs.hostDistro == 'azl3' | ||
env: | ||
HOST_ARCH: ${{ inputs.hostArch }} | ||
run: | | ||
set -eux | ||
sudo tdnf install -y \ | ||
libvirt libvirt-daemon libvirt-daemon-config-network \ | ||
libvirt-daemon-kvm libvirt-devel qemu-kvm qemu-img python3-libvirt \ | ||
python3-devel edk2-ovmf azure-cli \ | ||
rpm coreutils util-linux systemd openssl \ | ||
sed createrepo_c squashfs-tools cdrkit e2fsprogs dosfstools \ | ||
xfsprogs zstd veritysetup grub2 binutils lsof git docker | ||
if [[ "$HOST_ARCH" == "amd64" ]]; then | ||
sudo tdnf install -y grub2-pc | ||
fi | ||
sudo systemctl restart libvirtd | ||
sudo systemctl status libvirtd | ||
|
||
- name: Install prerequisites (Ubuntu 24.04) | ||
if: inputs.hostDistro == 'ubuntu2404' | ||
env: | ||
HOST_ARCH: ${{ inputs.hostArch }} | ||
run: | | ||
set -eux | ||
sudo apt update -y | ||
sudo apt -y install \ | ||
qemu-utils rpm coreutils util-linux mount fdisk udev openssl \ | ||
sed createrepo-c squashfs-tools genisoimage e2fsprogs dosfstools \ | ||
xfsprogs zstd cryptsetup-bin grub2-common binutils lsof \ | ||
python3-venv python3-pip python3-dev \ | ||
libvirt-dev libvirt-daemon libvirt-daemon-system libvirt-clients \ | ||
qemu-kvm virt-manager docker.io | ||
if [[ "$HOST_ARCH" == "arm64" ]]; then | ||
sudo apt -y install qemu-system-arm qemu-efi-aarch64 ovmf vgabios | ||
fi | ||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash || true | ||
sudo systemctl restart libvirtd | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repo | ||
|
||
- name: Build osmodifier and imagecustomizer | ||
run: | | ||
set -eux | ||
pushd ./repo/toolkit | ||
sudo env "PATH=$PATH" make go-osmodifier go-imagecustomizer | ||
popd | ||
|
||
- name: Build imagecustomizer container (for VM prep) | ||
run: | | ||
set -eux | ||
pushd ./repo/toolkit | ||
./tools/imagecustomizer/container/build-container.sh -t "${IMAGE_CUSTOMIZER_CONTAINER_TAG}" | ||
popd | ||
|
||
- name: Test setup | ||
run: | | ||
set -eux | ||
pushd ./repo/test/vmtests | ||
# SSH key for VM access | ||
[[ -f ~/.ssh/id_ed25519 ]] || ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" | ||
make create-venv | ||
popd | ||
|
||
- name: Run OSModifier tests | ||
working-directory: repo/test/vmtests | ||
run: | | ||
set -eux | ||
sudo make test-osmodifier \ | ||
IMAGE_CUSTOMIZER_CONTAINER_TAG="${IMAGE_CUSTOMIZER_CONTAINER_TAG}" \ | ||
OSMODIFIER_BIN="../../toolkit/out/tools/osmodifier" \ | ||
INPUT_IMAGE="${{ inputs.inputImage }}" \ | ||
SSH_PRIVATE_KEY_FILE="$HOME/.ssh/id_ed25519" \ | ||
LOGS_DIR="./out" | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: tests-results-osmodifier-${{ inputs.hostDistro }}-${{ inputs.hostArch }} | ||
path: repo/test/vmtests/out |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.