diff --git a/.semaphore/semaphore-scheduled-builds.yml b/.semaphore/semaphore-scheduled-builds.yml index 5f63555b7c2..410f6dbccef 100644 --- a/.semaphore/semaphore-scheduled-builds.yml +++ b/.semaphore/semaphore-scheduled-builds.yml @@ -1362,7 +1362,7 @@ blocks: - export NC_PLUGIN_REPO=$(dirname $(pwd)) - export NC_PLUGIN_REF=$(git rev-parse --abbrev-ref HEAD) - sudo git config --system --add safe.directory ${NC_PLUGIN_REPO}/.git - - TEMPEST=true DEVSTACK_BRANCH=unmaintained/yoga ./devstack/bootstrap.sh + - TEMPEST=true OPENSTACK_RELEASE=yoga ./devstack/bootstrap.sh epilogue: on_fail: commands: @@ -1400,7 +1400,7 @@ blocks: - export NC_PLUGIN_REPO=$(dirname $(pwd)) - export NC_PLUGIN_REF=$(git rev-parse --abbrev-ref HEAD) - sudo git config --system --add safe.directory ${NC_PLUGIN_REPO}/.git - - TEMPEST=true DEVSTACK_BRANCH=unmaintained/2024.1 ./devstack/bootstrap.sh + - TEMPEST=true OPENSTACK_RELEASE=caracal ./devstack/bootstrap.sh epilogue: always: commands: diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 4b38a09743b..9b549a47785 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -1362,7 +1362,7 @@ blocks: - export NC_PLUGIN_REPO=$(dirname $(pwd)) - export NC_PLUGIN_REF=$(git rev-parse --abbrev-ref HEAD) - sudo git config --system --add safe.directory ${NC_PLUGIN_REPO}/.git - - TEMPEST=true DEVSTACK_BRANCH=unmaintained/yoga ./devstack/bootstrap.sh + - TEMPEST=true OPENSTACK_RELEASE=yoga ./devstack/bootstrap.sh epilogue: on_fail: commands: @@ -1400,7 +1400,7 @@ blocks: - export NC_PLUGIN_REPO=$(dirname $(pwd)) - export NC_PLUGIN_REF=$(git rev-parse --abbrev-ref HEAD) - sudo git config --system --add safe.directory ${NC_PLUGIN_REPO}/.git - - TEMPEST=true DEVSTACK_BRANCH=unmaintained/2024.1 ./devstack/bootstrap.sh + - TEMPEST=true OPENSTACK_RELEASE=caracal ./devstack/bootstrap.sh epilogue: always: commands: diff --git a/.semaphore/semaphore.yml.d/blocks/40-openstack.yml b/.semaphore/semaphore.yml.d/blocks/40-openstack.yml index a515f2f2ad7..295a277487c 100644 --- a/.semaphore/semaphore.yml.d/blocks/40-openstack.yml +++ b/.semaphore/semaphore.yml.d/blocks/40-openstack.yml @@ -38,7 +38,7 @@ - export NC_PLUGIN_REPO=$(dirname $(pwd)) - export NC_PLUGIN_REF=$(git rev-parse --abbrev-ref HEAD) - sudo git config --system --add safe.directory ${NC_PLUGIN_REPO}/.git - - TEMPEST=true DEVSTACK_BRANCH=unmaintained/yoga ./devstack/bootstrap.sh + - TEMPEST=true OPENSTACK_RELEASE=yoga ./devstack/bootstrap.sh epilogue: on_fail: commands: @@ -77,7 +77,7 @@ - export NC_PLUGIN_REPO=$(dirname $(pwd)) - export NC_PLUGIN_REF=$(git rev-parse --abbrev-ref HEAD) - sudo git config --system --add safe.directory ${NC_PLUGIN_REPO}/.git - - TEMPEST=true DEVSTACK_BRANCH=unmaintained/2024.1 ./devstack/bootstrap.sh + - TEMPEST=true OPENSTACK_RELEASE=caracal ./devstack/bootstrap.sh epilogue: always: commands: diff --git a/networking-calico/Makefile b/networking-calico/Makefile index 63499437149..2b39a2a7cdb 100644 --- a/networking-calico/Makefile +++ b/networking-calico/Makefile @@ -21,7 +21,7 @@ upper-constraints-yoga.txt: curl -fsSL --retry 5 https://releases.openstack.org/constraints/upper/yoga -o $@ upper-constraints-caracal.txt: - curl -fsSL --retry 5 https://raw.githubusercontent.com/openstack/requirements/refs/heads/unmaintained/2024.1/upper-constraints.txt -o $@ + curl -fsSL --retry 5 https://raw.githubusercontent.com/openstack/requirements/refs/heads/$$(./infer-openstack-branch.sh caracal requirements)/upper-constraints.txt -o $@ fmtpy: build-test-container $(RUN_TEST_CONTAINER) tox -e black diff --git a/networking-calico/devstack/bootstrap.sh b/networking-calico/devstack/bootstrap.sh index 7c29fb1191a..237879c3fe7 100755 --- a/networking-calico/devstack/bootstrap.sh +++ b/networking-calico/devstack/bootstrap.sh @@ -53,11 +53,16 @@ sudo pip list || true # For a single node Calico/DevStack cluster, the environment should leave # SERVICE_HOST unset. # +# OPENSTACK_RELEASE +# +# The OpenStack release to test with, e.g. "yoga" or "caracal". This is +# used to calculate the value of DEVSTACK_BRANCH when not already set. +# # DEVSTACK_BRANCH # -# By default this script uses the master branch of devstack. To use a -# different branch, set the DEVSTACK_BRANCH environment variable before -# running this script; for example: +# By default this script uses the appropriate DevStack branch for +# OPENSTACK_RELEASE. To use a different branch, set the DEVSTACK_BRANCH +# environment variable before running this script; for example: # # export DEVSTACK_BRANCH=stable/liberty # @@ -80,27 +85,18 @@ sudo pip list || true # # ------------------------------------------------------------------------------ -# Handle branch name transition from "stable/yoga" to "unmaintained/yoga". The DevStack repo -# internally still uses "stable/yoga" for all its defaults even though all the actual branch names -# have changed to "unmaintained/yoga". -if [ "${DEVSTACK_BRANCH}" = unmaintained/yoga ]; then - export CINDER_BRANCH=unmaintained/yoga - export GLANCE_BRANCH=unmaintained/yoga - export KEYSTONE_BRANCH=unmaintained/yoga - export NEUTRON_BRANCH=unmaintained/yoga - export NOVA_BRANCH=unmaintained/yoga - export PLACEMENT_BRANCH=unmaintained/yoga - export REQUIREMENTS_BRANCH=unmaintained/yoga +if [ -z "${DEVSTACK_BRANCH}" ]; then + DEVSTACK_BRANCH=$(./infer-openstack-branch.sh ${OPENSTACK_RELEASE} devstack) fi # Set correct constraints for Tempest to use. We need to do this because we're pinning to a # different version of Tempest than the version that DevStack would naturally use. case "${DEVSTACK_BRANCH}" in - unmaintained/yoga ) + */yoga ) export UPPER_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/yoga ;; - unmaintained/2024.1 ) # Caracal - export UPPER_CONSTRAINTS_FILE=https://raw.githubusercontent.com/openstack/requirements/refs/heads/unmaintained/2024.1/upper-constraints.txt + * ) + export UPPER_CONSTRAINTS_FILE=https://raw.githubusercontent.com/openstack/requirements/refs/heads/${DEVSTACK_BRANCH}/upper-constraints.txt ;; esac diff --git a/networking-calico/infer-openstack-branch.sh b/networking-calico/infer-openstack-branch.sh new file mode 100755 index 00000000000..9a1e59cb7f2 --- /dev/null +++ b/networking-calico/infer-openstack-branch.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Infer the current branch name for the OpenStack release $1 in repo name $2. +if [ $# -ne 2 ]; then + echo "Usage: $0 " + echo + echo "For example: $0 caracal devstack" + exit 1 +fi +RELEASE=$1 +REPO=$2 + +# Translate modern OpenStack release names to their YEAR.NUMBER form. +FORMAL_RELEASE=${RELEASE} +case "${RELEASE}" in + caracal ) + FORMAL_RELEASE=2024.1 + ;; + gazpacho ) + FORMAL_RELEASE=2026.1 + ;; +esac + +if [ $(git ls-remote -h https://github.com/openstack/${REPO} refs/heads/stable/${FORMAL_RELEASE} | wc -l) = 1 ]; then + echo stable/${FORMAL_RELEASE} + exit 0 +fi + +if [ $(git ls-remote -h https://github.com/openstack/${REPO} refs/heads/unmaintained/${FORMAL_RELEASE} | wc -l) = 1 ]; then + echo unmaintained/${FORMAL_RELEASE} + exit 0 +fi + +echo "ERROR: can't identify branch for OpenStack ${RELEASE} in ${REPO}" +exit 1