ci: bound apt phases and retry the official Ubuntu mirror

This commit is contained in:
XxJSONDeruloxX authored and Kurt Himebauch committed 2026-10-23 13:48:55 -04:00
1 parent fcf4c09c50
commit 8355c1495b
3 files changed
+42 -11

No files matched your search

+7 -4
View File
@@ -18,21 +18,24 @@ class CiChecksTest(unittest.TestCase):
sudo = root / 'sudo'
sudo.write_text('#!/bin/bash\nprintf "%s\\n" "$*" >> "$APT_LOG"\nexit "${APT_RESULT:-0}"\n')
sudo.chmod(0o755)
query = root / 'dpkg-query'
query.write_text('#!/bin/sh\nexit 1\n')
query.chmod(0o755)
log = root / 'apt.log'
env = dict(os.environ, PATH=str(root) + os.pathsep + os.environ['PATH'], APT_LOG=str(log))
installer = ROOT / 'tools/ci/install-ubuntu-packages.sh'
result = subprocess.run(['bash', str(installer), 'qemu-user'], env=dict(env, APT_RESULT='17'))
self.assertEqual(result.returncode, 17)
self.assertEqual(len(log.read_text().splitlines()), 1)
self.assertEqual(len(log.read_text().splitlines()), 2)
log.unlink()
subprocess.run(['bash', str(installer), 'qemu-user'], env=env, check=True)
update, install = log.read_text().splitlines()
for command in (update, install):
self.assertIn('Dir::Etc::sourceparts=-', command)
self.assertIn('Acquire::https::Timeout=30', command)
self.assertIn('Acquire::Retries=3', command)
self.assertIn('Acquire::https::Timeout=15', command)
self.assertIn('Acquire::Retries=1', command)
self.assertIn('APT::Update::Error-Mode=any', update)
self.assertIn('install -y -qq --no-install-recommends qemu-user', install)
self.assertIn('install -y -q --no-install-recommends qemu-user', install)
def test_required_status_rejects_failed_cancelled_or_skipped_test_jobs(self):
jobs = yaml.safe_load((ROOT / '.github/workflows/build.yml').read_text())['jobs']