Skip to content

Sort the builds based on the tagging timestamp #719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions scripts/pkg_in_pipe/pkg_in_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,20 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
'--github-token', help="The token used to access the Github api", default=os.environ.get('GITHUB_TOKEN')
)
parser.add_argument('--cache', help="The cache path", default="/tmp/pkg_in_pipe.cache")
parser.add_argument(
'--tag', '-t', dest='tags', help="The koji tags to include in the report", action='append', default=[]
)
parser.add_argument(
'--package', '-p', dest='packages', help="The packages to include in the report", action='append', default=[]
)
args = parser.parse_args()

CACHE = diskcache.Cache(args.cache)
RETENTION_TIME = 24 * 60 * 60 # 24 hours

DEFAULT_TAGS = [f'v{v}-{p}' for v in ['8.2', '8.3'] for p in ['incoming', 'ci', 'testing', 'candidates', 'lab']]
tags = args.tags or DEFAULT_TAGS

# load the issues from plane, so we can search for the plane card related to a build
try:
resp = requests.get(
Expand Down Expand Up @@ -299,16 +308,22 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
print_plane_warning(out)
if not gh:
print_github_warning(out)
tags = [f'v{v}-{p}' for v in ['8.2', '8.3'] for p in ['incoming', 'ci', 'testing', 'candidates', 'lab']]
with io.StringIO() as temp_out:
try:
# open koji session
config = koji.read_config("koji")
session = koji.ClientSession('https://kojihub.xcp-ng.org', config)
session.ssl_login(config['cert'], None, config['serverca'])
for tag in tags:
tag_history = dict(
(tl['build_id'], tl['create_ts'])
for tl in session.queryHistory(tag=tag, active=True)['tag_listing']
)
print_table_header(temp_out, tag)
for tagged in sorted(session.listTagged(tag), key=lambda build: int(build['build_id']), reverse=True):
taggeds = session.listTagged(tag)
taggeds = [t for t in taggeds if t['package_name'] in args.packages or args.packages == []]
taggeds = sorted(taggeds, key=lambda t: (tag_history[t['build_id']], t['build_id']), reverse=True)
for tagged in taggeds:
build = session.getBuild(tagged['build_id'])
prs: list[PullRequest] = []
maintained_by = None
Expand Down