Skip to content

Support MRs generated by LocalRegistry.jl #35

@arnaudh

Description

@arnaudh

A few months ago, LocalRegistry.jl added the option of generating GitLab Merge Requests (MRs) to a PackageRegistry (GunnarFarneback/LocalRegistry.jl#49).

However the generated MRs have a body/description with the following format:

• Registering package: Example<br>• Repository: gitlab.foo.com/foo/bar<br>• Version: v0.1.2<br>• Commit: abcdef<br>• Triggered by: @john.doe<br>

We can see the fields are not separated by newline characters, but instead by <br> HTML elements. This is to workaround the fact that the MR is created via git push options and newlines are not supported there (there is a mention of this in that LocalRegistry MR GunnarFarneback/LocalRegistry.jl#49).

TagBotGitLab fails to parse such MR body, with the following error:

Traceback (most recent call last):
File "/var/task/tagbotgitlab/tagbot.py", line 32, in handler
status, msg = 200, handle_event(json.loads(evt.get("body", "
{}
")))
File "/var/task/tagbotgitlab/tagbot.py", line 56, in handle_event
return handle_merge(payload)
File "/var/task/tagbotgitlab/tagbot.py", line 124, in handle_merge
release_notes = changelog.get(version, commit)
File "/var/task/gitlabchangelog/changelog.py", line 238, in get
data = self._collect_data(version, sha)
File "/var/task/gitlabchangelog/changelog.py", line 183, in _collect_data
previous = self._previous_release(version)
File "/var/task/gitlabchangelog/changelog.py", line 74, in _previous_release
cur_ver = semver.VersionInfo.parse(_strip_starting_v(version))
File "/var/task/semver.py", line 726, in parse
raise ValueError("%s is not valid SemVer string" % version)
ValueError: 0.1.2<br>• Commit: abcdef<br>• Triggered by: @john.doe<br> is not valid SemVer string

i.e. it believes the version string is 0.1.2<br>• Commit: abcdef<br>• Triggered by: @john.doe<br>, since the regex matches all characters until the end of line. Passing that string to semver.VersionInfo.parse rightfully produces an error.

We should change the regexes to support MRs generated both by Registrator.jl (containing newlines) and LocalRegistry.jl (containing <br> and ).

I'll submit a PR for this soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions