PBR

multiple tags of the same commit have non-deterministic results

Bug #1453996 reported by Ravi K Repaka on 2015-05-11
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
PBR
High
Unassigned

Bug Description

Steps to reproduce:

git clone <email address hidden>:openstack/oslo.config.git
git checkout 1.4.0
python setup.py --version
Installed /home/rrepaka/workspace/oslo.config/pbr-0.11.0-py2.6.egg
[pbr] Generating ChangeLog
1.4.0.0a5

The command "python setup.py --version" returns "1.4.0.0a5" it should actually return "1.4.0".

This was working fine with pbr 0.10

Robert Collins (lifeless) wrote :

Works for me.

oslo.config$ git checkout 1.4.0
HEAD is now at 059579a... Merge "Looks for variable subtitution in the same group"
robertc@lifeless-z140:~/work/oslo.config$ python setup.py egg_info
running egg_info
writing pbr to oslo.config.egg-info/pbr.json
writing requirements to oslo.config.egg-info/requires.txt
writing oslo.config.egg-info/PKG-INFO
writing namespace_packages to oslo.config.egg-info/namespace_packages.txt
writing top-level names to oslo.config.egg-info/top_level.txt
writing dependency_links to oslo.config.egg-info/dependency_links.txt
writing entry points to oslo.config.egg-info/entry_points.txt
[pbr] Processing SOURCES.txt
[pbr] In git context, generating filelist from git
warning: no files found matching 'AUTHORS'
warning: no files found matching 'ChangeLog'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
reading manifest template 'MANIFEST.in'
warning: no files found matching 'AUTHORS'
warning: no files found matching 'ChangeLog'
warning: no previously-included files found matching '.gitignore'
warning: no previously-included files found matching '.gitreview'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
writing manifest file 'oslo.config.egg-info/SOURCES.txt'
robertc@lifeless-z140:~/work/oslo.config$ grep Version oslo.config.egg-info/PKG-INFO
Metadata-Version: 1.1
Version: 1.4.0
        * License: Apache License, Version 2.0

Changed in pbr:
status: New → Incomplete
Robert Collins (lifeless) wrote :

1.4.0 and 1.4.0.0a5 both reference the same commit.

We need to pull all the tags for that commit out, and take the semver highest one.

Changed in pbr:
status: Incomplete → Triaged
importance: Undecided → High
summary: - pbr-0.11.0 Returns wrong version string for oslo-config
+ multiple tags of the same commit have non-deterministic results
Robert Collins (lifeless) wrote :

We use 'git describe --exact-match' to obtain this version today, so this is a non-trivial change (and could have perf implications) unless we can find some way to get git to output what we need as efficiently.

It also suggests that git is outputting a surprising tag here, and we should figure out why.

Robert Collins (lifeless) wrote :

Reporter reports that git describe --exact-match is outputting 1.4.0!

Robert Collins (lifeless) wrote :

Found where we're getting the tags from - _get_revno_and_last_tag

But we already have this logic in place:
    for row_count, (ignored, tag_set, ignored) in enumerate(changelog):
        version_tags = set()
        for tag in list(tag_set):
            try:
                version_tags.add(version.SemanticVersion.from_pip_string(tag))
            except Exception:
                pass
        if version_tags:
            return max(version_tags).release_string(), row_count

Robert Collins (lifeless) wrote :

More data: fault seem to be isolated to RHEL 2.6 Python versions at the moment - My reproduction test works on 2.6 and 2.7 on Ubuntu.

Ebbex (eb4x) wrote :
Download full text (3.6 KiB)

I think we've run into this issue recently;

Oct 20 15:49:53 Collecting networking_calico from git+file:///var/www/repo/openstackgit/networking-calico@79bdf4995d102833d23479180350216fc59e4b94#egg=networking_calico&gitname=networking-calico&projectgroup=neutron_all (from -c /var/www/repo/os-releases/18.1.13.dev3/ubuntu-18.04-x86_64/requirements_constraints.txt (line 24))
163 Oct 20 15:49:53 Cloning file:///var/www/repo/openstackgit/networking-calico (to revision 79bdf4995d102833d23479180350216fc59e4b94) to /tmp/openstack-builder/networking-calico
164 Oct 20 15:49:53 Complete output from command python setup.py egg_info:
165 Oct 20 15:49:53 ERROR:root:Error parsing
166 Oct 20 15:49:53 Traceback (most recent call last):
167 Oct 20 15:49:53 File "/openstack/venvs/repo-build-18.1.13.dev3/local/lib/python2.7/site-packages/pbr/core.py", line 96, in pbr
168 Oct 20 15:49:53 attrs = util.cfg_to_args(path, dist.script_args)
169 Oct 20 15:49:53 File "/openstack/venvs/repo-build-18.1.13.dev3/local/lib/python2.7/site-packages/pbr/util.py", line 259, in cfg_to_args
170 Oct 20 15:49:53 pbr.hooks.setup_hook(config)
171 Oct 20 15:49:53 File "/openstack/venvs/repo-build-18.1.13.dev3/local/lib/python2.7/site-packages/pbr/hooks/__init__.py", line 25, in setup_hook
172 Oct 20 15:49:53 metadata_config.run()
173 Oct 20 15:49:53 File "/openstack/venvs/repo-build-18.1.13.dev3/local/lib/python2.7/site-packages/pbr/hooks/base.py", line 27, in run
174 Oct 20 15:49:53 self.hook()
175 Oct 20 15:49:53 File "/openstack/venvs/repo-build-18.1.13.dev3/local/lib/python2.7/site-packages/pbr/hooks/metadata.py", line 26, in hook
176 Oct 20 15:49:53 self.config['name'], self.config.get('version', None))
177 Oct 20 15:49:53 File "/openstack/venvs/repo-build-18.1.13.dev3/local/lib/python2.7/site-packages/pbr/packaging.py", line 824, in get_version
178 Oct 20 15:49:53 version = _get_version_from_git(pre_version)
179 Oct 20 15:49:53 File "/openstack/venvs/repo-build-18.1.13.dev3/local/lib/python2.7/site-packages/pbr/packaging.py", line 764, in _get_version_from_git
180 Oct 20 15:49:53 result = _get_version_from_git_target(git_dir, target_version)
181 Oct 20 15:49:53 File "/openstack/venvs/repo-build-18.1.13.dev3/local/lib/python2.7/site-packages/pbr/packaging.py", line 726, in _get_version_from_git_target
182 Oct 20 15:49:53 dict(new=new_version, target=target_version))
183 Oct 20 15:49:53 ValueError: git history requires a target version of pbr.version.SemanticVersion(3.9.2), but target version is pbr.version.SemanticVersion(3.8.4)
184 Oct 20 15:49:53 error in setup command: Error parsing /tmp/openstack-builder/networking-calico/setup.cfg: ValueError: git history requires a target version of pbr.version.SemanticVersion(3.9.2), but target version is pbr.version.SemanticVersion(3.8.4)
185 Oct 20 15:49:53
186 Oct 20 15:49:53 ----------------------------------------
187 Oct 20 15:49:54 Command "python setup.py egg_info" failed with error code 1 in /tmp/openstack-builder/networking-calico/
188

Looking at the git state in networking-calico;

$ git l...

Read more...

Ok, that's how to reproduce it:
1. git clone https://opendev.org/openstack/networking-calico
2. Add constraints.txt file with content:
git+file:///home/user/networking-calico@79bdf4995d102833d23479180350216fc59e4b94#egg=networking_calico&gitname=networking-calico&projectgroup=neutron_all
where /home/user/networking-calico is path to the cloned repo
3. Add requirements.txt with "networking-calico" in it
4. Run pip wheel --timeout 120 --wheel-dir /tmp/wheel-output --constraint constraints.txt --requirement requirements.txt

masterpe (michiel-y) wrote :

I hit this issue on OSA 18.1.12 while following https://docs.openstack.org/openstack-ansible/latest/admin/upgrades/minor-upgrades.html

To solve this issue I change /opt/openstack-ansible/playbooks/defaults/repo_packages/openstack_services.yml

The variable networking_calico_git_install_branch back to 87e780110d3ba0f0b57154ad74f9254aa950acda # HEAD as of 02.06.2019

Maksim Malchuk (mmalchuk) wrote :

the same issue with OSA 17.1.6 and 17.1.17:

ERROR:root:Error parsing
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pbr/core.py", line 111, in pbr
    attrs = util.cfg_to_args(path, dist.script_args)
  File "/usr/local/lib/python2.7/dist-packages/pbr/util.py", line 249, in cfg_to_args
    pbr.hooks.setup_hook(config)
  File "/usr/local/lib/python2.7/dist-packages/pbr/hooks/__init__.py", line 25, in setup_hook
    metadata_config.run()
  File "/usr/local/lib/python2.7/dist-packages/pbr/hooks/base.py", line 27, in run
    self.hook()
  File "/usr/local/lib/python2.7/dist-packages/pbr/hooks/metadata.py", line 26, in hook
    self.config['name'], self.config.get('version', None))
  File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 740, in get_version
    version = _get_version_from_git(pre_version)
  File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 680, in _get_version_from_git
    result = _get_version_from_git_target(git_dir, target_version)
  File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 642, in _get_version_from_git_target
    dict(new=new_version, target=target_version))
ValueError: git history requires a target version of pbr.version.SemanticVersion(3.10.1), but target version is pbr.version.SemanticVersion(3.9.3)
error in setup command: Error parsing /tmp/openstack-builder/networking-calico/setup.cfg: ValueError: git history requires a target version of pbr.version.SemanticVersion(3.10.1), but target version is pbr.version.SemanticVersion(3.9.3)

checkout back one commit helps with OSA deploy

Maksim Malchuk (mmalchuk) wrote :

OSA 17.1.16 and 17.1.17 sorry

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers