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

Use hostname command as fallback way of getting build host name #354

Merged
merged 1 commit into from Mar 3, 2015

Conversation

@mizdebsk
Copy link
Contributor

mizdebsk commented Nov 20, 2014

  • getHostName() may fail for number of reasons, for example when
    networking is disabled or network is down.
  • hostname command is a portable way of determining host name,
    which doesn't depend on networking to be available.

For more details, see: http://stackoverflow.com/a/7800008

For example, Fedora build servers don't have networking available, not even local loopback interface (localhost). As a result host name in Gradle build is always set to "unknown". This patch fixes the problem.

- getHostName() may fail for number of reasons, for example when
  networking is disabled or network is down.
- hostname command is a portable way of determining host name,
  which doesn't depend on networking to be available.
@tomdcc

This comment has been minimized.

Copy link
Member

tomdcc commented Nov 23, 2014

We're having some internal discussion on the best way to do this. Is the HOSTNAME environment variable available in your build infrastructure?

@mizdebsk

This comment has been minimized.

Copy link
Contributor Author

mizdebsk commented Nov 24, 2014

No, neither HOSTNAME env variable nor /etc/hostname file are available.

bigdaz added a commit that referenced this pull request Mar 3, 2015
Use hostname command as fallback way of getting build host name
@bigdaz bigdaz merged commit 4124c59 into gradle:master Mar 3, 2015
1 check passed
1 check passed
continuous-integration/travis-ci The Travis CI build passed
Details
@bigdaz

This comment has been minimized.

Copy link
Member

bigdaz commented Mar 3, 2015

Merged, thanks for the contribution.

@mizdebsk mizdebsk deleted the mizdebsk:hostname branch Mar 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.