Update update-constraints job and script

We often see failures on requirements patches generates after a release
was tagged that are due to the newly created version not being found yet
in the index. These require a recheck to resolve. Add a pause of 10
minutes before creating the requirements review in an attempt to reduce
the frequency of these failures.

Also fix some minor issues:

- The extraction of the SHORTNAME for the repo from remote.origin.url
  git config is broken, because zuul overrides that url to be /dev/null.
  Use the working directory name instead.
- Current python minor versions have two digits, amend the regex we are
  using to match these.
- Drop a workaround that was needed when Python 3.8 was new and shiny.
- Switch the nodeset this job is running on from ubuntu-focal to
  ubuntu-noble.

Change-Id: I6751ea91499bbc81c71dce6da7fbe982bbc03efe
This commit is contained in:
Dr. Jens Harbott 2024-08-15 12:16:50 +02:00
parent 2f6111efef
commit 45428f1f9f
3 changed files with 8 additions and 9 deletions

View File

@ -1,5 +1,9 @@
- hosts: all
tasks:
- name: Pause in order to allow pypi to catch up
ansible.builtin.pause:
minutes: 10
prompt: Pausing for 10 minutes in order to allow pypi to catch up
- name: Propose constraints update
command: "{{ ansible_user_dir }}/scripts/release-tools/update_constraints.sh {{ zuul.tag }}"

View File

@ -71,12 +71,12 @@ function get_tag_meta {
# Find the branch information from the tag metadata in the comment.
BRANCH=$(get_tag_meta branch)
# Pick up the repository name from the git URL.
SHORTNAME=$(basename $(git config --local remote.origin.url))
# Pick up the repository name from the current directory.
SHORTNAME=$(basename $(pwd))
# Extract python_version information from the package metadata.
declare -a PYTHON_3_VERSIONS
PYTHON_3_VERSIONS=`sed -n -e 's/^.*Programming.Language.*:://p' < setup.cfg | grep "3..$"`
PYTHON_3_VERSIONS=`sed -n -e 's/^.*Programming.Language.*:://p' < setup.cfg | grep "3...\?$"`
# Apply the PEP 503 rules to turn the dist name into a canonical form,
# in case that's the version that appears in upper-constraints.txt. We
@ -113,12 +113,6 @@ else
sed -e "s/^${dist_name}=.*;python_version=='$PYTHON_VERSION'/$dist_name===$VERSION;python_version=='$PYTHON_VERSION'/" --in-place upper-constraints.txt
sed -e "s/^${canonical_name}=.*;python_version=='$PYTHON_VERSION'/$canonical_name===$VERSION;python_version=='$PYTHON_VERSION'/" --in-place upper-constraints.txt
done
# Most projects don't declare Python 3.8 support yet, so update if the
# package declares Python 3.6 support. This follows the logic that
# generate-constraints does
if [[ $PYTHON_3_VERSIONS =~ '3.6' ]] ; then
sed -e "s/^${dist_name}=.*;python_version=='3.8'/$dist_name===$VERSION;python_version=='3.8'/" --in-place upper-constraints.txt
fi
# Then only update lines that do not have specific python_versions
# specified.
sed -e "s/^${dist_name}=.*[0-9]$/$dist_name===$VERSION/" --in-place upper-constraints.txt

View File

@ -820,6 +820,7 @@
Update constraint files for requirements project with a
proposed change.
run: playbooks/proposal/propose-update-constraints.yaml
nodeset: ubuntu-noble
protected: true
dependencies:
- release-openstack-python