Skip to content
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

Support MRs generated by LocalRegistry.jl #35

Open
arnaudh opened this issue Apr 27, 2022 · 0 comments
Open

Support MRs generated by LocalRegistry.jl #35

arnaudh opened this issue Apr 27, 2022 · 0 comments

Comments

@arnaudh
Copy link
Contributor

arnaudh commented Apr 27, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant