Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[migration-tools] Always release source version with updated release increment instead of last_version. #32112

Merged
merged 2 commits into from
Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions migration-tools/migrate-rosdistro.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,35 @@ def write_tracks_file(tracks, commit_msg=None):
# interactivity and :{auto} may result in a previously unreleased tag
# on the development branch being released for the first time.
if dest_track['version'] in [':{ask}', ':{auto}']:
# Override the version for this release to guarantee the same version is released.
# Override the version for this release to guarantee the same version from our
# source distribution is released.
dest_track['version_saved'] = dest_track['version']
dest_track['version'] = dest_track['last_version']
write_tracks_file(tracks, f'Update {args.dest} track to release exactly last-released version.')
source_version, source_inc = source_distribution.repositories[repo_name].release_repository.version.split('-')
dest_track['version'] = source_version
write_tracks_file(tracks, f'Update {args.dest} track to release the same version as the source distribution.')

if dest_track['release_tag'] == ':{ask}' and 'last_release' in dest_track:
# Override the version for this release to guarantee the same version is released.
dest_track['release_tag_saved'] = dest_track['release_tag']
dest_track['release_tag'] = dest_track['last_release']
write_tracks_file(tracks, f'Update {args.dest} track to release exactly last-released tag.')

# Update release increment for the upcoming release.
# We increment whichever is greater between the source distribution's
# release increment and the release increment in the bloom track since
# there may be releases that were not committed to the source
# distribution.
# This heuristic does not fully cover situations where the version in
# the source distribution and the version in the release track differ.
# In that case it is still possible for this tool to overwrite a
# release increment if the greatest increment of the source version is
# not in the source distribution and does not match the version
# currently in the release track.
release_inc = str(max(int(source_inc), int(dest_track['release_inc'])) + 1)

# Bloom will not run with multiple remotes.
subprocess.check_call(['git', 'remote', 'remove', 'oldorigin'])
subprocess.check_call(['git', 'bloom-release', '--non-interactive', '--unsafe', args.dest], env=os.environ)
subprocess.check_call(['git', 'bloom-release', '--non-interactive', '--release-increment', release_inc, '--unsafe', args.dest], env=os.environ)
subprocess.check_call(['git', 'push', 'origin', '--all', '--force'])
subprocess.check_call(['git', 'push', 'origin', '--tags', '--force'])
subprocess.check_call(['git', 'checkout', 'master'])
Expand Down