Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions scripts/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ reconcile the actual Central state first. If publication succeeded but SCM push
verify and push that exact signed history after reconciling branch advancement. Do not
prepare another release under the same version. If GitHub Release publication fails after
the push, preserve the existing tag and reconcile the published Central state first.
Restore `release.properties` with `scm.tag=VERSION`, the original `RELEASE_BASE_COMMIT`,
and the recovered signed history. Set `RELEASE_MAJOR`, `RELEASE_VERSION`,
Check out the recovered signed history and set the original `RELEASE_BASE_COMMIT`;
`release.properties` is not needed. Set `RELEASE_MAJOR`, `RELEASE_VERSION`,
`RELEASE_TARGET_TAG=scylla-MAJOR.x`, `RELEASE_DRY_RUN=false`, and
`GITHUB_REPOSITORY=scylladb/java-driver`, then run `python3 scripts/release/github_release.py`
with the trusted launch SHA's helper scripts and public certificate. The helper accepts an
Expand Down
8 changes: 6 additions & 2 deletions scripts/release/github_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ def publish():
raise Invalid('Unexpected driver release repository.')
version = target.version(major, os.environ['RELEASE_VERSION'])
# This uses only the public certificate and the original preparation baseline.
signing.verify_prepared()
# release:perform has deleted release.properties, so check the validated version's tag.
signing.verify_release(version)
verify_remote_tag(version)
existing = release(repository, version)
if existing is None:
# Like earlier releases: notes generated since this line's previous release, titled
# by the tag. Four parts skip upstream tags; gh rejects --notes-from-tag with --repo.
since = target.git('describe', '--tags', '--abbrev=0', '--match', f'{major}.*.*.*', version + '^')
gh('release', 'create', version, '--repo', 'github.com/' + repository,
'--verify-tag', '--notes-from-tag', '--title', f'ScyllaDB Java Driver {version}',
'--verify-tag', '--generate-notes', '--notes-start-tag', since,
'--latest' if major == '4' else '--latest=false')
existing = release(repository, version)
# Accept a matching immutable release on recovery without editing it. Refuse
Expand Down
13 changes: 11 additions & 2 deletions scripts/release/test_github_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def fixture(self, major='4'):
' print("HTTP/2.0 200 OK\\nContent-Type: application/json\\n")\n'
' print(state.read_text())\n'
'elif args[:2] == ["release", "create"]:\n'
' if "--notes-from-tag" in args and "--repo" in args:\n'
' raise SystemExit(1)\n'
' state.write_text(json.dumps({"tag_name": args[2], "draft": False,\n'
' "immutable": os.environ.get("MUTABLE") != "true"}))\n'
'else:\n'
Expand All @@ -59,6 +61,10 @@ def git(*args):
'-c', 'user.name=Fixture', '-c', 'user.email=fixture@example.invalid', *args,
], cwd=repo, text=True, stderr=subprocess.PIPE).strip()
git('init', '-q')
git('commit', '--allow-empty', '-qm', 'Previous release')
git('tag', '-a', major + '.1.2.2', '-m', 'Previous release')
git('commit', '--allow-empty', '-qm', 'Upstream release')
git('tag', '-a', major + '.1.3', '-m', 'Upstream three-part tag')
git('commit', '--allow-empty', '-qm', 'Fixture')
version = major + '.1.2.3'
git('tag', '-a', version, '-m', 'Prepared release')
Expand All @@ -73,7 +79,7 @@ def git(*args):
'GH_TOKEN': 'test-only-github-token', 'STATE': str(root / 'state.json'),
'TRACE': str(root / 'trace.jsonl'),
'CLI_FAIL': '', 'MUTABLE': '',
}), patch.object(signing, 'verify_prepared') as verify:
}), patch.object(signing, 'verify_release') as verify:
os.chdir(repo)
try:
yield root, git, verify
Expand All @@ -90,10 +96,13 @@ def test_both_lines_publish_once_and_accept_matching_immutable_release_on_recove
github_release.publish()
github_release.publish()
self.assertEqual(verify.call_count, 2)
verify.assert_called_with(major + '.1.2.3')
creates = [call for call in self.calls(root) if call[:2] == ['release', 'create']]
self.assertEqual(len(creates), 1)
self.assertIn('--verify-tag', creates[0])
self.assertIn('--notes-from-tag', creates[0])
self.assertIn('--generate-notes', creates[0])
self.assertEqual(creates[0][creates[0].index('--notes-start-tag') + 1], major + '.1.2.2')
self.assertNotIn('--title', creates[0])
self.assertIn('github.com/scylladb/java-driver', creates[0])
self.assertIn('--latest' if major == '4' else '--latest=false', creates[0])
self.assertNotIn('--draft', creates[0])
Expand Down
Loading