Ensure that we can build sdist from requested tags

Adding validation check to ensure that we are able to build sdist from
the latest tag.

This will allow us to detect sooner when we will try to add a tag to a branch
which is older than another tag already on that branch/in that branch's history

Indeed we recently experienced similar issue [1] with os-collect-config and
tripleo-ipsec where projects hadn't been branched for ussuri [2] and where
we tried to create a new ussuri release [3] on the same hash that an
existing wallaby tag.

Projects have been branched [3] after tags creation [2].

[1] http://lists.openstack.org/pipermail/openstack-discuss/2021-January/020112.html
[2] 688914aa29
[3] ihttps://review.opendev.org/c/openstack/releases/+/772047

Change-Id: Ie2d055f171418e2d35db697dfb1aa17cd449bea9
This commit is contained in:
Hervé Beraud 2021-02-17 15:13:35 +01:00
parent d7400dd14d
commit 80652b5232
1 changed files with 16 additions and 0 deletions

View File

@ -813,6 +813,22 @@ def validate_build_sdist(deliv, context):
gitutils.checkout_ref(
context.workdir, project.repo.name, project.hash, context)
# Set some git configuration values to allow us to perform
# local operations like tagging.
gitutils.ensure_basic_git_config(
context.workdir, project.repo.name,
{'user.email': 'openstack-infra@lists.openstack.org',
'user.name': 'OpenStack Proposal Bot'},
)
# Ensure us that build sdist will works with tags. That help to detect
# branching problems early. The goal is to avoid to try to add a tag
# to a branch which is older than another tag already on that
# branch/in that branch's history
gitutils.add_tag(
context.workdir, project.repo.name, release.version, project.hash
)
try:
pythonutils.build_sdist(
context.workdir, project.repo.name)