packit / packit-service

Packit provided as a service
https://packit.dev
MIT License
37 stars 48 forks source link

failing sync_release - handle case when version != tag_name #413

Closed dhodovsk closed 3 years ago

dhodovsk commented 4 years ago

Release failed for https://github.com/containerbuildsystem/koji-containerbuild and the error message in the issue was not at all helpful:

Issues:

After some digging I think I found the reason:

What happened a.k.a. how to reproduce the rebase helper error (up is packit Upstream):

>>> up.specfile.set_spec_version(version='koji-containerbuild-0.7.20-1')
rebase-helper failed to change the spec file: RebaseHelperError()
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/rebasehelper/helpers/rpm_helper.py", line 182, in parse_spec
    result = rpm.spec(tmp.name, flags) if flags is not None else rpm.spec(tmp.name)
ValueError: can't parse specfile

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/rebasehelper/helpers/rpm_helper.py", line 201, in get_rpm_spec
    spec = cls.parse_spec(path, flags=rpm.RPMSPEC_ANYARCH)
  File "/usr/lib/python3.7/site-packages/rebasehelper/helpers/rpm_helper.py", line 187, in parse_spec
    raise RebaseHelperError('Failed to parse SPEC file{0}'.format(': ' + str(output) if output else ''))
rebasehelper.exceptions.RebaseHelperError: Failed to parse SPEC file: error: line 18: Illegal char '-' (0x2d) in: Version:        koji-containerbuild-0.7.20-1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/rebasehelper/helpers/rpm_helper.py", line 182, in parse_spec
    result = rpm.spec(tmp.name, flags) if flags is not None else rpm.spec(tmp.name)
ValueError: can't parse specfile

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/packit/specfile.py", line 60, in set_spec_version
    self.set_version(version=version)
  File "/usr/lib/python3.7/site-packages/rebasehelper/specfile.py", line 502, in set_version
    self.set_tag('Version', version, preserve_macros=True)
  File "/usr/lib/python3.7/site-packages/rebasehelper/specfile.py", line 108, in wrapper
    spec.save()
  File "/usr/lib/python3.7/site-packages/rebasehelper/specfile.py", line 984, in save
    self.update()
  File "/usr/lib/python3.7/site-packages/rebasehelper/specfile.py", line 165, in update
    self.spc = RpmHelper.get_rpm_spec(self.path, self.sources_location, self.predefined_macros)
  File "/usr/lib/python3.7/site-packages/rebasehelper/helpers/rpm_helper.py", line 204, in get_rpm_spec
    spec = cls.parse_spec(path)
  File "/usr/lib/python3.7/site-packages/rebasehelper/helpers/rpm_helper.py", line 187, in parse_spec
    raise RebaseHelperError('Failed to parse SPEC file{0}'.format(': ' + str(output) if output else ''))
rebasehelper.exceptions.RebaseHelperError: Failed to parse SPEC file: error: line 18: Illegal char '-' (0x2d) in: Version:        koji-containerbuild-0.7.20-1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/packit/specfile.py", line 78, in set_spec_version
    raise PackitException("rebase-helper didn't do the job")
packit.exceptions.PackitException: rebase-helper didn't do the job

This is related to https://github.com/packit-service/packit-service/issues/392 but the character of the issue is a bit different - no upstream_tag_template use and checkout fine. But feel free to close one of these in favor of just issue with tag-name vs version.

dhodovsk commented 4 years ago

Sentry: https://sentry.io/organizations/red-hat-0p/issues/?project=1767823&query=trace.ctx%3A58a8b881f4eb4e54964e6d26746adac8-b41709bb422d5208

lachmanfrantisek commented 4 years ago

Sentry: https://sentry.io/organizations/red-hat-0p/issues/?project=1767823&query=trace.ctx%3A58a8b881f4eb4e54964e6d26746adac8-b41709bb422d5208

Unfortunately, the sentry link does not match anything and I am unable to find the related event.

dhodovsk commented 4 years ago

It has been more than 14 days (default search value) - this should work - https://sentry.io/organizations/red-hat-0p/issues/?project=1767823&query=trace.ctx%3A58a8b881f4eb4e54964e6d26746adac8-b41709bb422d5208&statsPeriod=90d

sentry-io[bot] commented 4 years ago

Sentry issue: RED-HAT-0P-25V

lachmanfrantisek commented 4 years ago

@dhodovsk thanks! (I've merged them and linked to this issue.)

TomasTomecek commented 4 years ago

Isn't the solution here for them to set upstream_tag_template in their packit.yaml?

dhodovsk commented 4 years ago

Might be, but the problem is also not showing a helpful error message (see description).

TomasTomecek commented 4 years ago

Might be, but the problem is also not showing a helpful error message (see description).

oh yeah, absolutely

stale[bot] commented 3 years ago

This issue has been marked as stale because it hasn't seen any activity for the last 60 days.

Stale issues are closed after 14 days, unless the label is removed by a maintainer or someone comments on it.

This is done in order to ensure that open issues are still relevant.

Thank you for your contribution! :unicorn: :rocket: :robot:

(Note: issues labeled with pinned or EPIC are never marked as stale.)

lachmanfrantisek commented 3 years ago

Since this is a really old issue and the code changed a lot, I am closing it. Please, reopen if you don't think so.