问题
First, I have svn configured to be accessible via apache DAV.
Then I have a post-commit hook that tell jenkins continuous integration server that the repository has changed via a simple wget command (and make it build) :
/opt/local/bin/wget (many-options) https://jenkins.domain.tld/subversion/${UUID}/notifyCommit?rev=$REV >> $LOGFILE
The script checks wget return code, and then echos an error message and exit with 1 (so the svn client knows the commit failed).
The LOGFILE contains after a failure :
--2012-04-04 10:56:54-- https://jenkins.domain.tld/subversion/4d729FFF-FFFF-4fb8-b8b5-be083cf6fe96/notifyCommit?rev=302
Résolution de jenkins.domain.tld (jenkins.domain.tld)... échec: Temporary failure in name resolution.
wget : impossible de résoudre l'adresse de l'hôte «jenkins.domain.tld»
The host jenkins.domain.tld
has been added to /etc/hosts
to be sure that resolution can't fail, but I'm still having the issue.
Of course, I have checked the post-commit command from CLI, and it works.
I've added this line to the post-commit script :
/usr/bin/host jenkins.domain.tld >> $LOGFILE
And resolution works just fine... maybe a wget issue.
Just replaced wget call with a curl equivalent, same issue :
curl: (6) Couldn't resolve host 'jenkins.domain.tld'
回答1:
Ok, not found the issue origin, but a solution (pretty ugly) :
Update: I solved it meanwhile by fully stopping apache, waiting for a moment, then starting it again. But that doesn't explain the root cause for this behaviour (and thus there's no satisfying solution). So I leave this open.
From : https://serverfault.com/questions/129772/php-gethostbyname-suddenly-no-longer-resolves-names-to-ips-when-run-in-apache
回答2:
After upgrading to Ubuntu 14.04 LTS I had the same issue (not sure whether the upgrade was really related). However, I could solve it by adding explicit timeout configuration to wget in my post-commit hook:
wget \
--timeout=10 \
--dns-timeout=10 \
...
来源:https://stackoverflow.com/questions/10008234/svn-post-commit-temporary-failure-in-name-resolution