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

Skip Bazel prefetch in prerequisite installation #22575

Merged
merged 2 commits into from
Feb 6, 2025

Conversation

tyler-yankee
Copy link
Contributor

@tyler-yankee tyler-yankee commented Jan 31, 2025

This follows from #22461. When installing --without-bazel, we need to skip a step in install_prereqs_user_environment which does a prefetch of the bazelisk download of bazel.


This change is Reviewable

@tyler-yankee
Copy link
Contributor Author

+@jwnimmer-tri for feature review, please!

Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee jwnimmer-tri(platform), needs at least two assigned reviewers, missing label for release notes (waiting on @tyler-yankee)


setup/ubuntu/source_distribution/install_prereqs_user_environment.sh line 23 at r1 (raw file):

      with_bazel=0
      ;;
    # Ignore other source distribution arguments.

Trying to keeping this list in sync with the set of options allowed by other scripts is too brittle, especially since we have zero CI coverage for most of these flags.

Instead, this should should offer a specific argument like --prefetch_bazel and only run the bazel version when that argument is supplied.

@jwnimmer-tri jwnimmer-tri added status: single reviewer ok https://drake.mit.edu/reviewable.html release notes: fix This pull request contains fixes (no new features) labels Jan 31, 2025
@tyler-yankee
Copy link
Contributor Author

setup/ubuntu/source_distribution/install_prereqs_user_environment.sh line 23 at r1 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

Trying to keeping this list in sync with the set of options allowed by other scripts is too brittle, especially since we have zero CI coverage for most of these flags.

Instead, this should should offer a specific argument like --prefetch_bazel and only run the bazel version when that argument is supplied.

Okay, fixed.

Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: 2 unresolved discussions, LGTM missing from assignee jwnimmer-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @tyler-yankee)


setup/ubuntu/install_prereqs.sh line 106 at r2 (raw file):

user_env_script_args=
if [[ "${source_distribution_args[@]}" == *"--developer"* ]] || \
   [[ "${source_distribution_args[@]}" == *"--with-bazel"* ]]; then

This is not correct in the presence of args like --without-bazel. The argument-processing loop above needs to set user_env_script_args= directly, just like it does the binary and source args.


setup/ubuntu/source_distribution/install_prereqs_user_environment.sh line 44 at r2 (raw file):

if [[ "${prefetch_bazel}" -eq 1 ]]; then
  (cd "${workspace_dir}" && bazel version)
fi

nit Missing newline at end of file.

Copy link
Contributor Author

@tyler-yankee tyler-yankee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 unresolved discussions, LGTM missing from assignee jwnimmer-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @tyler-yankee)


setup/ubuntu/install_prereqs.sh line 106 at r2 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

This is not correct in the presence of args like --without-bazel. The argument-processing loop above needs to set user_env_script_args= directly, just like it does the binary and source args.

Fixed.


setup/ubuntu/source_distribution/install_prereqs_user_environment.sh line 44 at r2 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

nit Missing newline at end of file.

Fixed.

Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee jwnimmer-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @tyler-yankee)


setup/ubuntu/install_prereqs.sh line 49 at r3 (raw file):

      ;;
    # Do NOT install bazelisk.
    --without-bazel)

This case needs to turn off the prefetch (when this flag comes after the --with-bazel).

@tyler-yankee
Copy link
Contributor Author

setup/ubuntu/install_prereqs.sh line 49 at r3 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

This case needs to turn off the prefetch (when this flag comes after the --with-bazel).

Sorry, I wasn't understanding what you meant before. This change should fix, pending CI checks.

Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 2 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: 2 unresolved discussions, LGTM missing from assignee jwnimmer-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @tyler-yankee)


setup/ubuntu/install_prereqs.sh line 49 at r3 (raw file):

Previously, tyler-yankee wrote…

Sorry, I wasn't understanding what you meant before. This change should fix, pending CI checks.

If I run setup/install_prereqs --with-bazel --without-bazel --with-bazel the user env command line ends up as:

sudo -u jwnimmer bash setup/ubuntu/source_distribution/install_prereqs_user_environment.sh '' --prefetch-bazel

Note the first argument is an empty string, and so when the user env script runs its while-loop to process the arguments, it stops at the first argument because its empty and fails to prefetch.

It might be easier to set prefetch_bazel=0 and prefetch_bazel=1 while handling the options here, and then turn that into the flag at the last moment when calling the user env script.


setup/ubuntu/install_prereqs.sh line 51 at r4 (raw file):

    --without-bazel)
      source_distribution_args+=(--without-bazel)
      # remove prefetch argument if already given

BTW In our C++ style guide we specify that comments must use correct punctuation and grammar, which means that if a comment is a complete sentence then it should be capitalized and end with a period. Even though this is bash code, we still follow that general rule across our whole project.

Suggestion:

Remove prefetch argument if already given.

Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: LGTM missing from assignee jwnimmer-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @tyler-yankee)

@jwnimmer-tri
Copy link
Collaborator

jwnimmer-tri commented Feb 6, 2025

:lgtm:

@jwnimmer-tri jwnimmer-tri merged commit 1c496a3 into RobotLocomotion:master Feb 6, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: fix This pull request contains fixes (no new features) status: single reviewer ok https://drake.mit.edu/reviewable.html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants