fedora-comps/ci/check-missing
Adam Williamson 4639c8ddac Run check-missing on development releases as part of CI
This is...wrong, but it's *usefully* wrong.

comps PRs aren't the only thing that can cause check-missing to
fail. They're not even the most *common* reason for check-missing
to fail. It's more likely to be caused by a package being retired
or a source package changing the binary packages it produces.

However, we cannot currently gate package retirements and/or
binary package set changes on this script. Doing so would require
a whole ton more work than just...doing this.

Doing this will cause us to notice problems the next time a comps
PR is touched. This is a definite improvement on us noticing
whenever I remember to run the script manually.

It will be somewhat annoying/inconvenient for people submitting
comps requests, but I think the benefit of problems in comps
getting noticed and fixed much more rapidly outweighs that.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-03-27 12:42:00 -07:00

54 lines
1.7 KiB
Python
Executable file

#!/bin/python3
# This is a silly wrapper around check-missing that runs it on all current releases,
# in parallel.
import asyncio
import requests
import subprocess
import sys
# thanks, https://stackoverflow.com/questions/63782892
async def run_command(*args, **kwargs):
"""
Run a command with subprocess such that we can run multiple
concurrently.
"""
# Create subprocess
process = await asyncio.create_subprocess_exec(
*args,
# stdout must a pipe to be accessible as process.stdout
stderr=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,
**kwargs,
)
# Wait for the subprocess to finish
stdout, stderr = await process.communicate()
# Return retcode, stdout and stderr
return (process.returncode, stdout.decode().strip(), stderr.decode().strip())
async def main():
reljson = requests.get("https://fedorapeople.org/groups/qa/metadata/release.json").json()["fedora"]
rels = reljson.get("branched", [])
if rels:
# we got branched, add rawhide
rels.append(max(rels)+1)
else:
# only rawhide, figure out rawhide rel number
curr = max(reljson["stable"])
rels = [curr+1]
tasks = [asyncio.create_task(run_command("./check-missing", str(rel))) for rel in rels]
rets = await asyncio.gather(*tasks, return_exceptions=True)
exitcode = 0
for (ret, rel) in zip(rets, rels):
print(f"Release: {rel}")
if isinstance(ret, Exception):
print(f"Error! {str(ret)}")
exitcode = 1
else:
print(ret[1])
if ret[0]:
exitcode = 1
sys.exit(exitcode)
asyncio.run(main())