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

  • 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
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
Copy link
Contributor Author

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

bigdaz pushed 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
@bigdaz
Copy link
Member

bigdaz commented Mar 3, 2015

Merged, thanks for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants