diff --git a/.github/workflows/gigabyte-ampere-cuttlefish-installer.yaml b/.github/workflows/gigabyte-ampere-cuttlefish-installer.yaml index 395eb9c02e9..c61294eb1f2 100644 --- a/.github/workflows/gigabyte-ampere-cuttlefish-installer.yaml +++ b/.github/workflows/gigabyte-ampere-cuttlefish-installer.yaml @@ -3,6 +3,7 @@ name: Workflow for Gigabyte Ampere Server Cuttlefish Installer on: pull_request: paths: + - '.github/workflows/gigabyte-ampere-cuttlefish-installer.yaml' - 'gigabyte-ampere-cuttlefish-installer/**' push: branchs: @@ -285,3 +286,50 @@ jobs: sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'echo cuttlefish | sudo -S -k shutdown -h 1' while ! grep "reboot: Power down" console_001.log; do sleep 30; done tail -n +"${CONSOLELINES}" console_001.log + + test-iso-cf-container-qemu-job: + needs: [build-installer-iso-job] + runs-on: ubuntu-22.04-arm + container: + image: debian@sha256:2c91e484d93f0830a7e05a2b9d92a7b102be7cab562198b984a84fdbc7806d91 # debian:trixie-20260202 + defaults: + run: + working-directory: ./gigabyte-ampere-cuttlefish-installer + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: gigabyte-ampere-cuttlefish-installer-artifacts + - name: Prepare test environment + uses: ./.github/actions/gigabyte-ampere-cuttlefish-installer-prepare-testbed + - name: Copy test scripts + run: | + cp -f tests/installer-iso-* . + - name: Run installer on qemu + run: | + ./installer-iso-install.expect + - name: Download Cuttlefish + run: | + ./utils/download-ci-cf.sh + - name: Start qemu again. Normal boot. + run: | + screen -d -m -L -Logfile console_001.log ./installer-iso-run-qemu.sh + while ! egrep "[^[:space:]]+[[:space:]]login:" console_001.log; do sleep 30; done + cp -f console_001.log console_001_p1.log + CONSOLELINES=$(cat console_001_p1.log | wc -l) + cat console_001_p1.log + grep "login:" console_001_p1.log > /dev/null + echo "CONSOLELINES=${CONSOLELINES}" >> $GITHUB_ENV + - name: Test whether Host Orchestrator in the docker instance is alive or not. + run: | + sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'echo cuttlefish | sudo -S -k docker pull us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-orchestration:nightly' + sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'echo cuttlefish | sudo -S -k docker run -d --privileged -p 4080:2080 us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-orchestration:nightly' + sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'curl http://localhost:4080/cvds -v --retry 6 --retry-all-errors --retry-delay 10' + sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'curl http://localhost:4080/cvds -v' | tr -d '[:space:]' | grep -xq '{"cvds":\[\]}' + - name: Shutdown qemu + run: | + sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'echo cuttlefish | sudo -S -k shutdown -h 1' + while ! grep "reboot: Power down" console_001.log; do sleep 30; done + tail -n +"${CONSOLELINES}" console_001.log diff --git a/gigabyte-ampere-cuttlefish-installer/preseed/after_install_1.sh b/gigabyte-ampere-cuttlefish-installer/preseed/after_install_1.sh index 5fd29a9ddb6..4259186369b 100755 --- a/gigabyte-ampere-cuttlefish-installer/preseed/after_install_1.sh +++ b/gigabyte-ampere-cuttlefish-installer/preseed/after_install_1.sh @@ -109,27 +109,3 @@ curl -fsSL --retry 7 --retry-all-errors https://nvidia.github.io/libnvidia-conta tee /etc/apt/sources.list.d/nvidia-container-toolkit.list apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y -q --force-yes nvidia-container-toolkit - -# Find container image tagged with most recent stable version -DEBIAN_FRONTEND=noninteractive apt-get install -y -q --force-yes skopeo -ORCHESTRATION_IMAGE="us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-orchestration" -STABLE_DIGEST=$(skopeo inspect docker://${ORCHESTRATION_IMAGE}:stable --format '{{.Digest}}') -CANDIDATES=$(skopeo list-tags docker://${ORCHESTRATION_IMAGE} | jq -r '.Tags[] | select(test("^[0-9]+\\.[0-9]+\\.[0-9]+$"))' | sort -V -r) -ORCHESTRATION_TAG="" -for CANDIDATE in $CANDIDATES; do - DIGEST=$(skopeo inspect docker://${ORCHESTRATION_IMAGE}:${CANDIDATE} --format '{{.Digest}}') - if [ "$DIGEST" = "$STABLE_DIGEST" ]; then - ORCHESTRATION_TAG=${CANDIDATE} - break - fi -done - -# Run dockerd for a moment and pull container image -mount -t cgroup2 none /sys/fs/cgroup -dockerd >/dev/null 2>&1 & -DOCKER_PID=$! -timeout=10 sh -c 'until [ -S /var/run/docker.sock ]; do sleep 1; done' -docker pull ${ORCHESTRATION_IMAGE}:${ORCHESTRATION_TAG} -kill $DOCKER_PID -wait $DOCKER_PID -umount /sys/fs/cgroup