Skip to content

Commit

Permalink
test/cases/ubi-wsl: test rhel9 ga
Browse files Browse the repository at this point in the history
  • Loading branch information
croissanne committed May 29, 2024
1 parent 0ad74e0 commit 5d1094a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
9 changes: 6 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,12 @@ ubi-wsl.sh:
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/ubi-wsl.sh
variables:
RUNNER: aws/rhel-8.9-ga-x86_64
INTERNAL_NETWORK: "true"
parallel:
matrix:
- RUNNER:
- aws/rhel-8.9-ga-x86_64
- aws/rhel-9.3-ga-x86_64
INTERNAL_NETWORK: "true"

weldr-distro-dot-notation+aliases:
stage: test
Expand Down
20 changes: 15 additions & 5 deletions test/cases/ubi-wsl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ cloud_login
$AZURE_CMD version

# Create a windows VM from the WSL snapshot image
if ! $AZURE_CMD snapshot show --name "$AZURE_WSL_SNAPSHOT" --resource-group "$AZURE_RESOURCE_GROUP"; then
if ! $AZURE_CMD snapshot show --name "$AZURE_WSL_SNAPSHOT_2" --resource-group "$AZURE_RESOURCE_GROUP"; then
redprint "WSL snapshot missing from test resource group"
exit 1
fi
Expand All @@ -181,7 +181,7 @@ $AZURE_CMD disk create \
--sku "Standard_LRS" \
--location "$AZURE_WSL_LOCATION" \
--size-gb 128 \
--source "$AZURE_WSL_SNAPSHOT"
--source "$AZURE_WSL_SNAPSHOT_2"

# Create VM by attaching created managed disks as OS
# The VM needs to support virtualization, supposedly all v4 and v5's support this but this wasn't
Expand Down Expand Up @@ -231,14 +231,24 @@ done

sudo chmod 600 "$AZ_WSL_HOST_PRIVATE_KEY"
sudo scp -i "$AZ_WSL_HOST_PRIVATE_KEY" -o StrictHostKeyChecking=no "$DISK" "$AZURE_WSL_USER@$HOST:"
ssh -i "$AZ_WSL_HOST_PRIVATE_KEY" -o StrictHostKeyChecking=no "$AZURE_WSL_USER@$HOST" \
wsl --import ibwsl ibwsl "$DISK"

UNAME=$(ssh -i "$AZ_WSL_HOST_PRIVATE_KEY" -o StrictHostKeyChecking=no "$AZURE_WSL_USER@$HOST" wsl -d ibwsl uname)
# Use absolute path to wsl.exe to avoid "The file cannot be accessed by the system."
ssh -i "$AZ_WSL_HOST_PRIVATE_KEY" -o StrictHostKeyChecking=no "$AZURE_WSL_USER@$HOST" \
'"C:\Program Files\WSL\wsl.exe"' --import ibwsl ibwsl "$DISK"

UNAME=$(ssh -i "$AZ_WSL_HOST_PRIVATE_KEY" -o StrictHostKeyChecking=no "$AZURE_WSL_USER@$HOST" '"C:\Program Files\WSL\wsl.exe"' -d ibwsl uname)
if [ ! "$UNAME" = "Linux" ]; then
redprint "Not running linux on the windows host :("
exit 1
fi

OS_RELEASE=$(ssh -i "$AZ_WSL_HOST_PRIVATE_KEY" -o StrictHostKeyChecking=no "$AZURE_WSL_USER@$HOST" '"C:\Program Files\WSL\wsl.exe"' -d ibwsl cat /etc/os-release)
WSL_ID=$(echo "$OS_RELEASE" | grep "^ID=" | cut -d '=' -f2 | tr -d '"')
WSL_VERSION_ID=$(echo "$OS_RELEASE" | grep "^VERSION_ID=" | cut -d '=' -f2 | tr -d '"')

if [ ! "$DISTRO_CODE" = "$WSL_ID-$WSL_VERSION_ID" ]; then
redprint "wsl os-release ($WSL_ID-$WSL_VERSION_ID) is not the same as the test runner os-release ($DISTRO_CODE)"
exit 1
fi

exit 0

0 comments on commit 5d1094a

Please sign in to comment.