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

JDK-8297000 [jib] Add more friendly warning for proxy issues #11159

Closed
wants to merge 3 commits into from

Conversation

LudwikJaniuk
Copy link
Contributor

@LudwikJaniuk LudwikJaniuk commented Nov 15, 2022

When jib tries to download itself behind a proxy, sometimes it can get a different file than it expected. This can result in cryptic errors that are hard to troubleshoot. Let's handle this a little more gracefully by detecting it in the bootstrapper and printing an error.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8297000: [jib] Add more friendly warning for proxy issues

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11159/head:pull/11159
$ git checkout pull/11159

Update a local copy of the PR:
$ git checkout pull/11159
$ git pull https://git.openjdk.org/jdk pull/11159/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11159

View PR using the GUI difftool:
$ git pr show -t 11159

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11159.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 15, 2022

👋 Welcome back lujaniuk! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 15, 2022
@openjdk
Copy link

openjdk bot commented Nov 15, 2022

@LudwikJaniuk The following label will be automatically applied to this pull request:

  • build

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the build build-dev@openjdk.org label Nov 15, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 15, 2022

Webrevs

@openjdk
Copy link

openjdk bot commented Nov 15, 2022

@LudwikJaniuk This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8297000: [jib] Add more friendly warning for proxy issues

Reviewed-by: erikj, ihse

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 460 new commits pushed to the master branch:

  • 5b3d86f: 8297230: Update Marlin2D to 0.9.4.6
  • f4b5065: 8297435: Remove unused CompactibleSpaceClosure
  • bde0e35: 8297142: jdk/jfr/event/runtime/TestShutdown.java fails on Linux ppc64le and Linux aarch64
  • f26bd4e: 8297350: Update JMH devkit to 1.36
  • 470f342: 8296904: Improve handling of macos xcode toolchain
  • b4bd287: 8191406: [hidpi] sun/java2d/SunGraphics2D/DrawImageBilinear.java test fails
  • 412b436: 6201035: Document NPE for passing null insets to constructors and methods of several javax.swing.border.* classes
  • faf48e6: 8296329: jar validator doesn't account for minor class file version
  • 09f70da: 8296265: Use modern HTML in the JVMTI spec
  • e661c5a: 8296323: JVMTI can_support_virtual_threads not available for agents loaded into running VM
  • ... and 450 more: https://git.openjdk.org/jdk/compare/1d883c5312721980898f91898665b528948a985b...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@erikj79, @magicus) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 15, 2022
bin/jib.sh Outdated
PREFIX="${installed_jib_script}.gz: "
FILEOUTPUT=`file ${installed_jib_script}.gz`
# ${X:${#Y}} gives X without the first ${#Y} characters, and ${#Y} is length of Y.
FILEOUTPUT=${FILEOUTPUT:${#PREFIX}}
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a bashism. While we do have /bin/bash in the shebang, this does not really matter since we have no executable bit on the script, so users will have to explicitly call it with a shell. So many users are likely to do sh bin/jib.sh, and then this will break.

My recommendation would be to use standard tools like cut or grep instead, something like:

file $installedscript.gz | grep "gzip compressed data" -q
if test $? -neq 0; then 
...

Copy link
Member

Choose a reason for hiding this comment

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

(Warning: untested code)

I also would like to clarify the use of bash. For configure script, and scripts started by the makefiles, we rely on and enforce bash, so in those cases bashisms are accepted (and almost encouraged, at least good ones). But in "user facing" scripts like this, or the top level configure script, we want to make minimal assumptions about the shell used, since the shebang path means nothing in our case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@magicus I've changed to something inspired by your comment and tested on linux, solaris and macos. Do you think the current version would be ok?

Copy link
Member

@magicus magicus left a comment

Choose a reason for hiding this comment

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

Yes, this looks excellent!

@LudwikJaniuk
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 23, 2022
@openjdk
Copy link

openjdk bot commented Nov 23, 2022

@LudwikJaniuk
Your change (at version fcd186b) is now ready to be sponsored by a Committer.

@erikj79
Copy link
Member

erikj79 commented Nov 23, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Nov 23, 2022

Going to push as commit 0d93ab9.
Since your change was applied there have been 460 commits pushed to the master branch:

  • 5b3d86f: 8297230: Update Marlin2D to 0.9.4.6
  • f4b5065: 8297435: Remove unused CompactibleSpaceClosure
  • bde0e35: 8297142: jdk/jfr/event/runtime/TestShutdown.java fails on Linux ppc64le and Linux aarch64
  • f26bd4e: 8297350: Update JMH devkit to 1.36
  • 470f342: 8296904: Improve handling of macos xcode toolchain
  • b4bd287: 8191406: [hidpi] sun/java2d/SunGraphics2D/DrawImageBilinear.java test fails
  • 412b436: 6201035: Document NPE for passing null insets to constructors and methods of several javax.swing.border.* classes
  • faf48e6: 8296329: jar validator doesn't account for minor class file version
  • 09f70da: 8296265: Use modern HTML in the JVMTI spec
  • e661c5a: 8296323: JVMTI can_support_virtual_threads not available for agents loaded into running VM
  • ... and 450 more: https://git.openjdk.org/jdk/compare/1d883c5312721980898f91898665b528948a985b...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 23, 2022
@openjdk openjdk bot closed this Nov 23, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Nov 23, 2022
@openjdk
Copy link

openjdk bot commented Nov 23, 2022

@erikj79 @LudwikJaniuk Pushed as commit 0d93ab9.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build-dev@openjdk.org integrated Pull request has been integrated
3 participants