diff --git a/releasenotes/notes/repo-build-fix-upper-constraints-9e24c56520538df2.yaml b/releasenotes/notes/repo-build-fix-upper-constraints-9e24c56520538df2.yaml new file mode 100644 index 0000000..fcdf4cd --- /dev/null +++ b/releasenotes/notes/repo-build-fix-upper-constraints-9e24c56520538df2.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - The ``repo_build`` role now correctly applies OpenStack requirements + upper-constraints when building Python wheels. This resolves + https://bugs.launchpad.net/openstack-ansible/+bug/1605846 diff --git a/tasks/repo_set_facts.yml b/tasks/repo_set_facts.yml index 1648597..05aad6c 100644 --- a/tasks/repo_set_facts.yml +++ b/tasks/repo_set_facts.yml @@ -49,7 +49,7 @@ - name: Set upper constraints set_fact: - upper_constraints: "{{ _upper_constraints | pip_constraint_update(local_requirement_normalized) }}" + upper_constraints: "{{ local_requirement_normalized | pip_constraint_update(_upper_constraints) }}" when: slurp_upper_constraints | success tags: - repo-set-constraints diff --git a/tests/test-repo-build.yml b/tests/test-repo-build.yml index cab46a2..171057e 100644 --- a/tests/test-repo-build.yml +++ b/tests/test-repo-build.yml @@ -52,5 +52,31 @@ - name: Ensure that the nova venv is NOT present assert: that: "'nova-{{ repo_build_release_tag }}.tgz' not in venv_folder_content.stdout" + - name: Slurp upper constraints + slurp: + src: "{{ repo_build_git_dir }}/requirements/upper-constraints.txt" + register: slurp_upper_constraints + - name: Slurp requirements constraints + slurp: + src: "{{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_constraints.txt" + register: slurp_requirements_constraints + - name: Set fact for requirements constraints content + set_fact: + requirements_constraints_content: "{{ slurp_requirements_constraints.content | b64decode }}" + - name: Set fact for upper constraints dictionary + set_fact: + upper_constraints_dict: > + {%- set constraints = {} %} + {%- for package in slurp_upper_constraints.content | b64decode | splitlines %} + {%- set name = package | regex_replace('===.*$','') %} + {%- set version = package | regex_replace('^.*===','') %} + {%- set _ = constraints.update({name:version}) %} + {%- endfor %} + {{- constraints -}} + - name: Ensure that requirements constraints is applying upper constraints + assert: + that: requirements_constraints_content.find( "{{ item.key }}<={{item.value}}" ) != -1 + with_dict: upper_constraints_dict + when: requirements_constraints_content.find(item.key) != -1 vars_files: - test-vars.yml