1

i have a simple "free-style" test job in huson. it checks out a file from git (it does that part successfully) it is also supposed to exec a script that appends to that file.

the script looks like:

#!/bin/sh -ex
echo "$0 was run on " `date` >> /tmp/failme.log
#echo "$0 was run on " `date` >> $HUDSON_HOME/failme.log
echo "this should fail"
echo "this went to stderr" >&2
exit -1

I put the 2nd line to test if the script is even run. /tmp/failme.log is missing after a "successful" build i can run the script as the hudson user (after allowing it to login) and the script behave properly.

I'm at a loss. I've read several inquiries here and in other forums and blogs about using hudson variables in scripts. none of them talk about anything special that i have to do to get hudson to exec the script.

thanks in advance.

nodnarb (strike that, reverse it)

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
nodnarb
  • 21
  • 3
  • Your shebang says "sh", but your question tag says "bash". Which is it? There's nothing wrong with your script. There must be something that you're not showing or mentioning that is the source of the problem. What happens, however, if you remove the `-ex`? – Dennis Williamson Dec 07 '10 at 01:31
  • Exactly how are you executing it by hand? Is the script executable? – sorpigal Dec 07 '10 at 02:03
  • sh vs bash: sh is a symln to bash. – nodnarb Dec 07 '10 at 17:21
  • more info: i've checked the "console output" on the build page, and there is no attempt to run this script recorded there. also the failme.log file is not created so, I know that the script is not being run. – nodnarb Dec 07 '10 at 17:24
  • by hand: "su - hudson" then "bash -ex /usr/bin/test_fail.sh" – nodnarb Dec 07 '10 at 17:24
  • i have given login rights to the hudson user (temporarily) – nodnarb Dec 07 '10 at 17:24
  • removing the "-ex" does not change anything. the failme.log file is still not created. no related errors in the hudson log. it seems that hudson is not exec'ing my build script. – nodnarb Dec 07 '10 at 17:34
  • can you post your config.xml and the console output? – Peter Schuetze Dec 07 '10 at 22:34

1 Answers1

1

yes, i'm answering my own question. I attempted the same configuration with a new job, and the script runs as expected. I have no reason for this. I have attempted to dup the failure above 3 times, and cannot duplicate this issue. So, I am resolving this issue. maybe something "hiccuped" when the original job was created.

Thank you to all who commented. B

nodnarb
  • 21
  • 3