Skip to content

Commit

Permalink
Populate signoffs with a commit message of the tag in extra-testing, …
Browse files Browse the repository at this point in the history
…not the latest commit

Fixes #533
  • Loading branch information
lahwaacz committed Dec 7, 2024
1 parent cfd188a commit 4fa4ea4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/management/commands/populate_signoffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_specification(package, log, finder):
return spec


def get_last_log(repo, pkgbase):
def get_tag_info(repo, pkgbase, version):
# Gitlab requires the path to the gitlab repo to be html encoded and project name encoded in a different special way
pkgrepo = urllib.parse.quote_plus(f'{settings.GITLAB_PACKAGE_REPO}/') + gitlab_project_name_to_path(pkgbase)
url = f'https://{settings.GITLAB_INSTANCE}/api/v4/projects/{pkgrepo}/repository/tags'
Expand All @@ -65,8 +65,12 @@ def get_last_log(repo, pkgbase):
return None

tags = r.json()

# filter out unrelated tags
tags = [tag for tag in tags if tag["name"] == version]

if len(tags) == 0:
logger.error("No tags found for pkgbase %s (%s)", pkgbase, repo)
logger.error("No tags found for pkgbase %s (%s) version %s", pkgbase, repo, version)
return None

tag = tags[0]
Expand All @@ -89,7 +93,7 @@ def add_signoff_comments():
if not group.default_spec:
continue

log = get_last_log(group.repo, group.pkgbase)
log = get_tag_info(group.repo, group.pkgbase, group.version)
if log is None:
continue

Expand Down

0 comments on commit 4fa4ea4

Please sign in to comment.