Skip to content

Commit

Permalink
release_playbook: Modifications used for v0.27.0 (RobotLocomotion#14651)
Browse files Browse the repository at this point in the history
Add download_release_candidate script
Use un-escaped docstring (given usage of backslash)
Should not break lines at 80-characters for PR bullet points
Be more explicit about full-symbol expansion for new bindings
Add more info to ping to Jamie
Warn about github commit search
Should announce on Slack
  • Loading branch information
EricCousineau-TRI authored Feb 18, 2021
1 parent db51497 commit 7b60291
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 51 deletions.
86 changes: 36 additions & 50 deletions doc/release_playbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Prior to release
issue labels for now.
5. For release notes, on an ongoing basis, add recent commit messages to the
release notes draft using the ``tools/release_engineering/relnotes`` tooling.
(Instructions for using ``relnotes`` are found atop its `source code
(Instructions can be found atop its soure code: `relnotes.py
<https://github.com/RobotLocomotion/drake/blob/master/tools/release_engineering/relnotes.py>`_.)

a. On the first run, use ``--action=create`` to bootstrap the file.
Expand Down Expand Up @@ -73,8 +73,8 @@ the main body of the document:
* Expand all acronyms (eg, MBP -> MultibodyPlant, SG -> SceneGraph).
* Commits can be omitted if they only affect tests or non-installed examples.
TODO(jwnimmer-tri) Explain how to check if something is installed.
* In general you should mention removed classes and methods using their exact
name (for easier searching).
* In general you should mention new bindings and deprecated/removed classes and
methods using their exact name (for easier searching).

* In the pydrake and deprecation sections in fact you can just put the
fully-qualified name as the whole line item; the meaning is clear from
Expand All @@ -101,6 +101,11 @@ the main body of the document:
fully supported. Be sure to take note of which these are, or ask on
#platform_review slack

* Keep all bullet points to one line.

* Using hard linebreaks to stay under 80 columns makes the bullet lists hard
to maintain over time.

Cutting the release
-------------------

Expand All @@ -110,66 +115,45 @@ Cutting the release
b. Make sure https://drake-jenkins.csail.mit.edu/view/Nightly%20Production/
has nothing still running (modulo the ``*-coverage`` builds, which we can
ignore)
c. Take
https://drake-jenkins.csail.mit.edu/view/Packaging/job/mac-catalina-unprovisioned-clang-bazel-nightly-snopt-packaging/
and
https://drake-jenkins.csail.mit.edu/view/Packaging/job/linux-bionic-unprovisioned-gcc-bazel-nightly-snopt-packaging/
and
https://drake-jenkins.csail.mit.edu/view/Packaging/job/linux-focal-unprovisioned-gcc-bazel-nightly-snopt-packaging/
builds for that night and make sure they share the same git sha (``HEAD``
from the moment they were launched). Note it.

i. If the git sha for all three does not match, wait and try again
tomorrow night.
c. Open the latest builds from the following builds:

d. Check the logs for those packaging builds and find the URLs they posted
to. It will be ``YYYYMMDD`` with today's date (they kick off after
midnight). Note it.
1) https://drake-jenkins.csail.mit.edu/view/Packaging/job/mac-catalina-unprovisioned-clang-bazel-nightly-snopt-packaging/
2) https://drake-jenkins.csail.mit.edu/view/Packaging/job/linux-bionic-unprovisioned-gcc-bazel-nightly-snopt-packaging/
3) https://drake-jenkins.csail.mit.edu/view/Packaging/job/linux-focal-unprovisioned-gcc-bazel-nightly-snopt-packaging/

i. N.B. The packaging script uploads the file twice, with two different
names. One is ``YYYYMMDD`` and one is ``latest``. We will use the
``YYYYMMDD`` one.
d. Check the logs for those packaging builds and find the URLs they posted
to (open the latest build, go to "View as plain text", and search for
``drake/nightly/drake-20``), and find the date. It will be ``YYYYMMDD``
with today's date (they kick off after midnight). All of the builds
should have the same date. If not, wait until the following night.

e. Use the
``tools/release_engineering/download_release_candidate`` tool to download
and verify that all the release candidates are built from the same
commit. (It's usage
instructions are atop its source code: `download_release_candidate.py
<https://github.com/RobotLocomotion/drake/blob/master/tools/release_engineering/download_release_candidate.py>`_.)

10. Update the release notes to have the ``YYYYMMDD`` we choose, and to make
sure that the nightly build git sha from the prior step matches the
``newest_commit`` whose changes are enumerated in the notes.
11. Prepare the binaries

a. Make a local folder, maybe ``$HOME/tmp/v0.N.0``
b. Fetch all the things (
https://drake-jenkins.csail.mit.edu/view/Packaging/job/mac-catalina-unprovisioned-clang-bazel-nightly-snopt-packaging/
and
https://drake-jenkins.csail.mit.edu/view/Packaging/job/linux-bionic-unprovisioned-gcc-bazel-nightly-snopt-packaging/
and
https://drake-jenkins.csail.mit.edu/view/Packaging/job/linux-focal-unprovisioned-gcc-bazel-nightly-snopt-packaging/)

i. ``wget https://drake-packages.csail.mit.edu/drake/nightly/drake-YYYYMMDD-bionic.tar.gz``
ii. ``wget https://drake-packages.csail.mit.edu/drake/nightly/drake-YYYYMMDD-bionic.tar.gz.sha512``
iii. ``wget https://drake-packages.csail.mit.edu/drake/nightly/drake-YYYYMMDD-focal.tar.gz``
iv. ``wget https://drake-packages.csail.mit.edu/drake/nightly/drake-YYYYMMDD-focal.tar.gz.sha512``
v. ``wget https://drake-packages.csail.mit.edu/drake/nightly/drake-YYYYMMDD-mac.tar.gz``
vi. ``wget https://drake-packages.csail.mit.edu/drake/nightly/drake-YYYYMMDD-mac.tar.gz.sha512``

c. Checksums

i. ``sha512sum -c *.sha512``
ii. ``sha256sum drake-YYYYMMDD-bionic.tar.gz > drake-YYYYMMDD-bionic.tar.gz.sha256``
iii. ``sha256sum drake-YYYYMMDD-focal.tar.gz > drake-YYYYMMDD-focal.tar.gz.sha256``
iv. ``sha256sum drake-YYYYMMDD-mac.tar.gz > drake-YYYYMMDD-mac.tar.gz.sha256``
v. ``sha256sum -c *.sha256``

12. Merge the release notes PR
11. Merge the release notes PR

a. After merge, go to https://drake-jenkins.csail.mit.edu/view/Documentation/job/linux-bionic-unprovisioned-gcc-bazel-nightly-documentation/ and push "Build now".

i. If you don't have "Build now" click "Log in" first in upper right.

13. Open https://github.com/RobotLocomotion/drake/releases and choose "Draft a
12. Open https://github.com/RobotLocomotion/drake/releases and choose "Draft a
new release". Note that this page does has neither history nor undo. Be
slow and careful!

a. Tag version is: v0.N.0
b. Target is: [the git sha from above]

* You should select the commit from Target > Recent Commits. The search
via commit does not work if you don't use the correct length.

c. Release title is: Drake v0.N.0
d. The body of the release should be forked from the prior release (open the
prior release's web page and click "Edit" to get the markdown), with
Expand All @@ -182,11 +166,13 @@ Cutting the release
tarballs, and their 6 checksums)
f. Choose "Save draft" and take a deep breath.

14. Once the documentation build finishes, release!
13. Once the documentation build finishes, release!

a. Check that the link to drake.mit.edu docs from the GitHub release draft
page actually works.
b. Click "Publish release"
c. Notify @jamiesnape to manually tag docker images and upload the releases
to S3.
d. Party on, Wayne.
c. Notify @jamiesnape via a GitHub comment to manually tag docker images
and upload the releases to S3. Be sure to provide him with the binary
date, commit SHA, and release tag in the same ping.
d. Announce on Drake Slack, ``#general``.
e. Party on, Wayne.
6 changes: 6 additions & 0 deletions tools/release_engineering/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ drake_py_unittest_ubuntu_only(
],
)

# N.B. Since this downloads files, this is not put under test.
drake_py_binary_ubuntu_only(
name = "download_release_candidate",
srcs = ["download_release_candidate.py"],
)

add_lint_tests()
137 changes: 137 additions & 0 deletions tools/release_engineering/download_release_candidate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
r"""
Downloads the relevant archives, verifies they are all the same version, and
prepares to upload them per the release playbook.
Use bazel to build and use the tool:
bazel build //tools/release_engineering:download_release_candidate # build
bazel-bin/tools/release_engineering/download_release_candidate # run
Here's an example of how to download the archives:
bazel build //tools/release_engineering:download_release_candidate
bazel-bin/tools/release_engineering/download_release_candidate \
--version v0.27.0 --timestamp 20210216
"""

import argparse
import os
import shlex
import subprocess
import sys
import tarfile


class UserError(RuntimeError):
pass


def run(argv, check=True, shell=False, **kwargs):
if shell:
assert isinstance(argv, str)
cmd = argv
else:
assert isinstance(argv, list)
cmd = shlex_join(argv)
print(f"+ {cmd}", file=sys.stderr)
return subprocess.run(argv, check=check, shell=shell, **kwargs)


def shlex_join(argv):
# TODO(eric.cousineau): Replace this with `shlex.join` when we exclusively
# use Python>=3.8.
return " ".join(map(shlex.quote, argv))


def get_commit_from_version(tar_file, timestamp):
print(f"Extract version information from: {tar_file}...")
with tarfile.open(tar_file, "r") as tar:
version_member = tar.getmember("drake/share/doc/drake/VERSION.TXT")
with tar.extractfile(version_member) as f:
assert f is not None, tar_file
text = f.read().decode("utf8")
upload_timestamp, commit = text.split()
assert upload_timestamp.startswith(timestamp), (
tar_file, upload_timestamp, commit, timestamp,
)
return commit


def main():
parser = argparse.ArgumentParser(
prog="download_release_candidate", description=__doc__,
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument(
"--version", type=str, required=True,
help="Release version in vX.Y.Z format.")
parser.add_argument(
"--timestamp", type=str, required=True,
help="Drake archive timestamp in YYYYMMDD format.")
args = parser.parse_args()

version = args.version
timestamp = args.timestamp

release_dir = f"/tmp/drake-release/{version}"
if os.path.isdir(release_dir):
raise UserError(
f"Directory must not already exist: {release_dir}\n"
f"If you are re-running this script, please remove the "
f"directory.")

os.makedirs(release_dir)
print(f"+ cd {release_dir}", file=sys.stderr)
os.chdir(release_dir)

tar_file_list = [
f"drake-{timestamp}-bionic.tar.gz",
f"drake-{timestamp}-focal.tar.gz",
f"drake-{timestamp}-mac.tar.gz",
]

# Download.
base_url = "https://drake-packages.csail.mit.edu/drake/nightly"
for tar_file in tar_file_list:
run(["wget", f"{base_url}/{tar_file}"])
run(["wget", f"{base_url}/{tar_file}.sha512"])

# Verify that each archive uses the same version.
commit_list = [
get_commit_from_version(tar_file, timestamp)
for tar_file in tar_file_list
]
commit_expected = commit_list[0]
version_errors = []
for tar_file, commit in zip(tar_file_list, commit_list):
if commit != commit_expected:
version_errors.append(
f"For '{tar_file}': Commit '{commit}' is not "
f"the expected value '{commit_expected}'")
if len(version_errors) > 0:
raise UserError("\n".join(version_errors))
print(f"All versions have the same commit: {commit_expected}")

# Checksums.
# - Verify downloaded sha512.
run("sha512sum -c *.sha512", shell=True)
# - Generate sha256.
for tar_file in tar_file_list:
run(f"sha256sum {tar_file} > {tar_file}.sha256", shell=True)
# - Verify.
run("sha256sum -c *.sha256", shell=True)

print()
print(
f"Ready! Please continue with the release playbook. The files "
f"to uploaded are located in the following folder (Ctrl+Click "
f"in the terminal to open in your file explorer):\n"
f"\n"
f" file://{release_dir}\n")


if __name__ == "__main__":
try:
main()
except UserError as e:
print(e, file=sys.stderr)
sys.exit(1)
2 changes: 1 addition & 1 deletion tools/release_engineering/relnotes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tool to help populate doc/release_notes/*.rst entries by automatically
r"""Tool to help populate doc/release_notes/*.rst entries by automatically
adding commit messages' content into a structured document template.
This program is intended only for use by Drake maintainers who are preparing
Expand Down

0 comments on commit 7b60291

Please sign in to comment.