From 9a6f452b6a944f4e0fa9d72d03026a2fbd480d10 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 20 Nov 2024 12:03:02 -0500 Subject: [PATCH 1/4] tests/conversion: strip lxd-migrate binary Signed-off-by: Simon Deziel --- tests/conversion | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/conversion b/tests/conversion index 3d3ffa20..88d8ecca 100755 --- a/tests/conversion +++ b/tests/conversion @@ -23,10 +23,12 @@ set -x # Install go from Snap. snap install go --classic +export PATH="${HOME}/go/bin:${PATH}" + # Install latest lxd-migrate binary tool. CGO_ENABLED=0 go install github.com/canonical/lxd/lxd-migrate@latest - -export PATH="${HOME}/go/bin:${PATH}" +# Make it smaller +strip --strip-all "$(command -v lxd-migrate)" # Configure LXD lxd init --auto --network-address "[::]" --network-port "8443" From b61fd70edd22e3ff6183a1775f1351ada93dbb28 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 20 Nov 2024 12:05:54 -0500 Subject: [PATCH 2/4] tests/conversion: copy lxd-migrate from host to instance Signed-off-by: Simon Deziel --- tests/conversion | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/conversion b/tests/conversion index 88d8ecca..19c7f613 100755 --- a/tests/conversion +++ b/tests/conversion @@ -175,8 +175,7 @@ conversion() { # Install rsync and lxd-migrate. lxc exec "${instName}" -- apt-get update lxc exec "${instName}" -- apt-get install --no-install-recommends -y rsync file - lxc exec "${instName}" -- snap install go --classic - lxc exec "${instName}" --env CGO_ENABLED=0 -- go install github.com/canonical/lxd/lxd-migrate@latest + lxc file push --create-dirs --mode 0755 --quiet "$(command -v lxd-migrate)" "${instName}"/root/go/bin/lxd-migrate # Set instName to the name of the new container that will be created # from the existing one. From 6e9c19a9db840854daa90f3ae7fbdbb476714ee0 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 20 Nov 2024 12:24:54 -0500 Subject: [PATCH 3/4] tests/conversion: fix some comments Signed-off-by: Simon Deziel --- tests/conversion | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conversion b/tests/conversion index 19c7f613..038bae53 100755 --- a/tests/conversion +++ b/tests/conversion @@ -200,11 +200,11 @@ conversion() { echo "${hostAddr}" # Address of the target LXD server. sleep 1 - echo "y" # Yes, this is correct fingerprint. + echo "y" # Confirm the local LXD server is the target. sleep 1 echo "1" # Use a certificate token. echo "${token}" # Token. - echo "${instTypeCode}" # Instace type (1 == container, 2 == virtual-machine). + echo "${instTypeCode}" # Instance type (1 == container, 2 == virtual-machine). if [ "$(lxc project ls -f csv | wc -l)" -gt 1 ]; then echo "default" # Project name (required if there is more then 1 project) From 2e19b3385c1359ce6dfdf62f2f18d7cfaee3ec9f Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 20 Nov 2024 13:09:15 -0500 Subject: [PATCH 4/4] tests/conversion: only install go if not already available GHA runners come with many Go versions bundled. Signed-off-by: Simon Deziel --- tests/conversion | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/conversion b/tests/conversion index 038bae53..7c1cfcf0 100755 --- a/tests/conversion +++ b/tests/conversion @@ -20,8 +20,10 @@ install_lxd set -x -# Install go from Snap. -snap install go --classic +if ! command -v go; then + # Install go from Snap. + snap install go --classic +fi export PATH="${HOME}/go/bin:${PATH}"