quotes in bash script on windows are being ignored

2014-07-09 Thread Dan Tenenbaum
Hi,

I have a jenkins project whose Execute shell command consists of this:


set -e  # Exit immediately if a simple command exits with a non-zero status
set -x verbose


export PKG=annotation
export SUFFIX=zip

ssh -o StrictHostKeyChecking=no -i $SSH_KEY jenk...@docbuilder.mydomain.org 
rm -f ~/repository/$PKG/*.$SUFFIX

If I run this script manually on the windows box, it works fine. 

That ssh command looks syntactically valid to me (SSH_KEY is defined in the 
node config) but it fails in jenkins. Since I have verbosity turned on this 
is the command I see (along with its output) in the jenkins build output:

+ ssh -o StrictHostKeyChecking=no -i c:/jenkins/docbuilder 
jenk...@docbuilder.mydomain.org rm -f ~/repository/annotation/*.zip
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
   [-D [bind_address:]port] [-e escape_char] [-F configfile]
   [-I pkcs11] [-i identity_file]
   [-L [bind_address:]port:host:hostport]
   [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
   [-R [bind_address:]port:host:hostport] [-S ctl_path]
   [-W host:port] [-w local_tun[:remote_tun]]
   [user@]hostname [command]


So it looks like the quotes in my command were somehow stripped. I think those 
quotes are needed in order for ssh to understand its arguments (otherwise the * 
is expanded before it gets to ssh, and so on). 


How can I fix that? I tried escaping the quotes with a backslash and then the 
command (when echoed) looked like this in the jenkins output:


+ ssh -o StrictHostKeyChecking=no -i c:/jenkins/docbuilder 
jenk...@docbuilder.mydomain.org rm -f ~/repository/annotation/*.zip

usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
   [-D [bind_address:]port] [-e escape_char] [-F configfile]
   [-I pkcs11] [-i identity_file]
   [-L [bind_address:]port:host:hostport]
   [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
   [-R [bind_address:]port:host:hostport] [-S ctl_path]
   [-W host:port] [-w local_tun[:remote_tun]]
   [user@]hostname [command]


So the quotes are now present but there is still something wrong with the 
command as seen by ssh.

If I copy and paste that command directly into an sh window on the windows node 
(a cygwin terminal window where I have exported SSH_KEY), it works.


Another thing I should mention is that I'm logged into the windows node as 
Administrator, but the jenkins slave is running as nt authority\system, a user 
who does not have the right to log on interactively. 


Any ideas? Thanks.








-- 
You received this message because you are subscribed to the Google Groups 
Jenkins Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


unable to connect slaves (behind firewalls) to master (in cloud) - this used to work

2013-09-25 Thread Dan Tenenbaum
Hello,

Previously I had a Jenkins master running on an EC2 instance in the Amazon 
cloud, and two slave nodes, one of which was also in EC2 and the other of 
which is here at my institution, behind a firewall. Both slaves connected 
to the master using Java Web Start and everything worked fine.

Now I am not able to set up new slaves inside my institution--they time out 
while handshaking with the master. And while my existing node inside the 
institute continued to work, after I disconnected it and tried to 
reconnect, it experienced the same problem. I am pretty sure that the 
problem is being behind the institution firewall, because when I unplugged 
my laptop from the ethernet cable and connected it to a public wi-fi 
network, it was able to connect, but when connected by ethernet only it 
times out during handshaking.

The master is running Jenkins ver. 1.532. The slaves are running the 
slave.jar from http://mymasternode.tld:8080/jnlpJars/slave.jar.

To be clear, the slave nodes CAN start a network connection with the 
master. I've set the master up to use a fixed port (33440) for JNLP slave 
agents, and made sure that port is made available in my EC2 security group.

From a machine at my institution I can do this (slightly edited):

$ telnet mymasternode.tld 33440
Trying xx.xx.xx.xx...
Connected to mymasternode.tld
Escape character is '^]'.

So that means in principle I can initiate a socket connection to the 
master. I try starting a slave agent like this:

java -Djava.awt.headless=true  -jar slave.jar -jnlpUrl 
http://mymasternode.tld:8080/computer/laptop/slave-agent.jnlp -secret 
LONGSECRETCODEGOESHERE

I get this:

Sep 25, 2013 4:55:55 PM hudson.remoting.jnlp.Main$CuiListener init
INFO: Jenkins agent is running in headless mode.
Sep 25, 2013 4:55:55 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://mymasternode.tld:8080/]
Sep 25, 2013 4:55:55 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to mymasternode.tld:33440
Sep 25, 2013 4:55:55 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Sep 25, 2013 4:55:56 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected

On the master in $JENKINS_HOME/logs/slaves/myslavename, I see this in the 
log:

NLP agent connected from /xx.xx.xx.xx
===[JENKINS REMOTING CAPACITY]===
 and then after several minutes I see this:
ERROR: Connection terminated
ha:WC+LCP9b85aBtbiIQSmjNKU4P08vOT+vOD8mVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWA=java.net.SocketException:
 
Connection timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:146)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at 
hudson.remoting.FlightRecorderInputStream.read(FlightRecorderInputStream.java:77)
at 
java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2271)
at 
java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2564)
at 
java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2574)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1314)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
at hudson.remoting.Command.readFrom(Command.java:92)
at 
hudson.remoting.ClassicCommandTransport.read(ClassicCommandTransport.java:71)
at 
hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)

Back at the slave, it still says 'connected'.

What is going on? OK, so I'm behind a firewall, but I've shown that I can 
initiate a socket connection, so why do inside-the-firewall slaves behave 
differently during the handshake than outside-the-firewall slaves which 
start right up just fine? Maybe something changed on my end but I don't 
know what it could be so not sure what to ask my IT folks about. Thought 
maybe someone here could help.

Thanks,
Dan



-- 
You received this message because you are subscribed to the Google Groups 
Jenkins Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


downstream job set by Parameterized Trigger never runs

2013-05-14 Thread Dan Tenenbaum
Hi,

I'm using the Parameterized Trigger plugin. I have a multi-configuration 
project (project A) which has a post-build action to Trigger parameterized 
build on other projects, configured to run another multi-configuration 
project (project B) when the build is stable, and pass B the current build 
parameters from A.

The problem is that the trigger does not seem to work. Project B never runs 
even though project A builds successfully. In fact even if I change the 
configuration on A to trigger B when the build is Complete (always 
trigger), it still does not trigger B.

What am I doing wrong?
Thanks,
Dan

-- 
You received this message because you are subscribed to the Google Groups 
Jenkins Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: downstream job set by Parameterized Trigger never runs

2013-05-14 Thread Dan Tenenbaum


On Tuesday, May 14, 2013 10:09:23 AM UTC-7, Dan Tenenbaum wrote:

 Hi,

 I'm using the Parameterized Trigger plugin. I have a multi-configuration 
 project (project A) which has a post-build action to Trigger parameterized 
 build on other projects, configured to run another multi-configuration 
 project (project B) when the build is stable, and pass B the current build 
 parameters from A.

 The problem is that the trigger does not seem to work. Project B never 
 runs even though project A builds successfully. In fact even if I change 
 the configuration on A to trigger B when the build is Complete (always 
 trigger), it still does not trigger B.

 What am I doing wrong?



If I check the Trigger build without parameters box, project B is indeed 
run. 
However, project B (which is currently just a shell script that prints out 
the current environment with 'env') does not display any of the build 
parameters from project A.

I don't understand what the Trigger build without parameters checkbox is. 
The whole reason I am running the Parameterized Trigger plugin is to be 
able to pass A's build parameters to B. If I look at the console output of 
B, I see 

originally caused by:
 Started by upstream project A build number 50

All I really need is that A (in other words, the name of the project that 
triggered B) but I'm not sure how to get it programmatically.

I should mention that A is not a parameterized project in that it does not 
take any special parameters. The parameters I want to pass to B are just 
the ordinary ones that Jenkins sets, like JOB_NAME and so forth. 

OK, it looks like maybe what I want to do is write a properties file in 
project A and pass that to project B with the Parameters from properties 
file option. But that doesn't seem to work. I can verify in project A that 
the properties file is written out and has the correct contents, but in 
project B I echo out the parameters I'm trying to pass and they are not 
defined. 

One clue is that if I check the Don't trigger if any files are missing 
box, project B does not run. This tells me that Jenkins *thinks* that there 
is no such properties file in my workspace, but there is. In the top level 
of the workspace I have a file called job.properties and I've put 
'job.properties' (without the quotes) in the Use properties from file 
box. 

However, it works if I use Predefined parameters like this:
PREV_WORKSPACE=$WORKSPACE

So I guess my question is answered. 

Thanks,
Dan

 

 Thanks,
 Dan



-- 
You received this message because you are subscribed to the Google Groups 
Jenkins Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




incorrect parameters passed to downstream build with Parameterized Trigger plugin

2013-05-14 Thread Dan Tenenbaum
Hi,

I have two multi-configuration projects, A and B.
Each job is configured to run on the same three nodes: the master (linux) 
and mac and windows slaves.

Project A is set up to trigger a build of B when A builds successfully, 
passing it the following predefined parameters (using the Parameterized 
Trigger plugin):

PREV_WORKSPACE=$WORKSPACE
PREV_JOB_NAME=$JOB_NAME
PREV_BUILD_TAG=$BUILD_TAG
PREV_BUILD_ID=$BUILD_ID
PREV_BUILD_DISPLAY_NAME=$BUILD_DISPLAY_NAME

For now, project B just calls a shell script that prints out some of these 
values. 
On the master, B says that $PREV_WORKSPACE is /var/lib/jenkins/workspace/A
which is correct. 
On the other nodes, though, it ALSO gives the same value for 
$PREV_WORKSPACE which is WRONG...the workspace path is different on each 
node.

Is this a bug? Can it be fixed?
Thanks,
Dan



-- 
You received this message because you are subscribed to the Google Groups 
Jenkins Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: difficulty connecting to Mac slave

2013-05-02 Thread Dan Tenenbaum
On Wed, May 1, 2013 at 8:12 PM, Kenny Ayers theotherwhitem...@gmail.com wrote:
 Hey Dan,

   Oh, I didn't notice you were using javaws.  Thank you for the correction.

 OK, so that ensures that the jenkins web app is always running, but

 I'm not clear whether that means that the slave will always be running

 (and in contact with the master).


   Presumably if the application successfully starts up successfully, that's
 what you'll get.

   The Jenkins log file location can vary according to how you started the
 service.  Can you grep out the startup command from the list of running
 services?  There is a logfile option.  For example you should see something
 like:

 $ ps aux | grep -i jenk

 java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true
 -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war
 --logfile=/var/log/jenkins/jenkins.log --daemon --debug=5
 --handlerCountMax=100 --handlerCountMaxIdle=20

   I looked over your JNLP startup command, and found that your OSX build
 agent seems to be trying to connect to localhost.  Are you running the
 master and slave on the same host?  If not, is there another instance of
 Jenkins master running on the build agent that you can kill (presumably this
 was accidentally setup and left running during testing)?  I've highlighted
 the line below where it shows that the JNLP agent is connecting to
 localhost:

 java -jar slave.jar -jnlpUrl
 http://dhcp151178:8080/computer/pelham/slave-agent.jnlp
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener init
 INFO: Jenkins agent is running in headless mode.
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener status
 INFO: Locating server among [http://localhost:8080/,
 http://dhcp151178:8080/]
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener status
 INFO: Connecting to localhost:49161
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener status
 INFO: Handshaking
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener error
 SEVERE: The server rejected the connection: Unauthorized access
 java.lang.Exception: The server rejected the connection: Unauthorized access
 at hudson.remoting.Engine.onConnectionRejected(Engine.java:257)
 at hudson.remoting.Engine.run(Engine.java:232)


   So that seems strange.

   A few more things to check: is the remote fs root specified correctly, and
 does it have the correct permissions?  Is the Jenkins URL specified
 correctly on the master node?

 Maybe getting closer...



OK, one thing I guess I did not understand was that the Jenkins webapp
does not need to be running on the slave. In fact, shutting it down
solved my problem. I was then able to start the slave by doing

java -Djava.awt.headless=true -jar slave.jar -jnlpUrl
http://master:8080/computer/slave/slave-agent.jnlp -secret
secret-key

And in fact I could start this command with 'nohup' and pipe its
output to a file (and put  on the end of it) and I don't need to be
logged in on the slave for my builds to work. I'll set up this command
to be run automatically at boot time and then everything will 'just
work' if the machine is rebooted.

Thanks very much for your help.
Dan


 -Kenny

 On Wednesday, May 1, 2013 6:54:23 PM UTC-7, Dan Tenenbaum wrote:

 On Wed, May 1, 2013 at 6:48 PM, Kenny Ayers theother...@gmail.com wrote:
  Hey Dan,
 
I noticed that in part of your reply, you said you had an issue
  starting
  the slave, but it looks there is a syntax error here:
 
  I also downloaded the JNLP manually and tried this:
 
  javaws -Jjava.awt.headless=true slave-agent.jnlp
 
  ...but I get:
 
  ...
 
  Splash: Can't connect to window server.: No such file or directory
 
  Wed May  1 15:04:49 pitt.fhcrc.org java[349] Error: kCGErrorFailure:
 
  Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are
 
  logged.
 
  Exception in thread main java.lang.InternalError: Can't connect to
 
  window server - not enough permissions.
 
 
Make sure you use -D, not -J.
 

 For javaws (as opposed to java) the command to pass an option to the
 JVM is -J, not -D.


Setting up an SSH tunnel from the master to slave should be a
  workaround
  for the security error you're getting.  Any reason your master has to be
  outside of your network in the EC2 cloud (I'm guessing this is part of
  an
  enterprise support scheme)?
 

 I would like all the build machines to be in EC2 but there are no
 virtual Mac machines because of licensing issues, so in order to build
 on the Mac I need to contact a machine on our internal network.

There are a few ways to run a Jenkins slave on startup for OSX.  Here
  is a
  link describing how to setup the Jenkins service (not slave):
 
  http://jrenard.info/blog/a-quick-but-working-startup-item-for-hudson-for-mac-os-x.html
  - you should be able to modify the contents of the plist file to run the
  slave service.
 

 OK, so that ensures that the jenkins web app is always running, but
 I'm not clear whether that means

Re: difficulty connecting to Mac slave

2013-05-01 Thread Dan Tenenbaum
On Tue, Apr 30, 2013 at 6:49 PM, Kenny Ayers
theotherwhitem...@gmail.com wrote:
 You're experiencing at least two issues here.  First there's the OSX bug
 with your window manager permissions.  You need to run headless on OSX, as
 you already determined, so make sure you continue to do that. (The bug is
 reported here: https://issues.jenkins-ci.org/browse/JENKINS-15697).

 Add this to the slave command line options: -Djava.awt.headless=true


This did the trick.
Thanks!
Dan


 Secondarily it seems like perhaps the slave node may not be properly
 configured within Jenkins?  Have you tried a combination of SSH + running
 headless (perhaps that was your error message you included)?

 I hope this helps,

 Kenny

 On Tuesday, April 30, 2013 5:28:11 PM UTC-7, Dan Tenenbaum wrote:

 Hi all,

 I have tried a number of methods to connect to a Mac slave and have had no
 success.

 My master is also a mac and it's called dhcp151178. The slave I'm trying
 to connect to is called pelham. These of course are machines on my internal
 network.

 The first method I tried was Launch slave agents on Unix machines via
 SSH.

 It looks like the master can connect to the slave via ssh but then I get
 the following (excerpted; full stack traces at end of message):

 java.io.IOException: Remote call on pelham failed

 ...

 Caused by: java.lang.InternalError: Can't connect to window server - not
 enough permissions.


 Then I tried Launch slave agents via Java Web Start

 And on the slave I navigated to
 http://dhcp151178:8080/computer/pelham/slave-agent.jnlp

 This gave me:


 java.lang.Exception: The server rejected the connection: Unauthorized
 access

 at hudson.remoting.Engine.onConnectionRejected(Engine.java:257)

 at hudson.remoting.Engine.run(Engine.java:232)


 Also, based on the following post:


 http://stackoverflow.com/questions/11824486/setting-up-a-hudson-slave-on-windows-xp


 I tried downloading the jnlp file from the URL above, replacing all
 instances of 'localhost' with 'dhcp151178' and launching the jnlp with
 javaws, this either gives me no console output at all (but the slave agent
 gui says Terminated) or it says:


 ...

 Exception in thread main java.lang.InternalError: Can't connect to
 window server - not enough permissions.


 I tried starting in headless mode, both as jenkins and as my regular admin
 user. I did this on the slave:


 java -jar slave.jar -jnlpUrl
 http://dhcp151178:8080/computer/pelham/slave-agent.jnlp
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener init
 INFO: Jenkins agent is running in headless mode.
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener status
 INFO: Locating server among [http://localhost:8080/,
 http://dhcp151178:8080/]
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener status
 INFO: Connecting to localhost:49161
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener status
 INFO: Handshaking
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener error
 SEVERE: The server rejected the connection: Unauthorized access
 java.lang.Exception: The server rejected the connection: Unauthorized
 access
 at hudson.remoting.Engine.onConnectionRejected(Engine.java:257)
 at hudson.remoting.Engine.run(Engine.java:232)


 There is no security set up on the master, so I'm not sure what the
 unauthorized access is about, and there is no -auth username:password that I
 can add to that command line.


 I'm not sure how to set up Launch slave via execution of command on the
 Master because I can't find much documentation for that.


 So I'm stuck. I was able to set up a windows slave so I know that it is
 possible. But the Mac slave does not want to start. Can you help?


 Thanks,

 Dan


 Addenda: full stack trace from trying to launch slave agents on the master
 using ssh:


 04/30/13 17:23:29] [SSH] Opening SSH connection to pelham:22.
 [04/30/13 17:23:29] [SSH] Authentication successful.
 [04/30/13 17:23:29] [SSH] The remote users environment is:
 BASH=/bin/bash
 BASH_ARGC=()
 BASH_ARGV=()
 BASH_EXECUTION_STRING=set
 BASH_LINENO=()
 BASH_SOURCE=()
 BASH_VERSINFO=([0]=3 [1]=2 [2]=48 [3]=1 [4]=release
 [5]=x86_64-apple-darwin10.0)
 BASH_VERSION='3.2.48(1)-release'
 DIRSTACK=()
 EUID=216
 GROUPS=()
 HOME=/Users/Shared/Jenkins
 HOSTNAME=pelham.fhcrc.org
 HOSTTYPE=x86_64
 IFS=$' \t\n'
 LOGNAME=jenkins
 MACHTYPE=x86_64-apple-darwin10.0
 MAIL=/var/mail/jenkins
 OPTERR=1
 OPTIND=1
 OSTYPE=darwin10.0
 PATH=/usr/bin:/bin:/usr/sbin:/sbin
 PPID=545
 PS4='+ '
 PWD=/Users/Shared/Jenkins
 SHELL=/bin/bash
 SHELLOPTS=braceexpand:hashall:interactive-comments
 SHLVL=1
 SSH_CLIENT='140.107.151.178 56267 22'
 SSH_CONNECTION='140.107.151.178 56267 140.107.150.101 22'
 TERM=dumb
 UID=216
 USER=jenkins
 _=bash
 [04/30/13 17:23:29] [SSH] Checking java version of java
 [04/30/13 17:23:29] [SSH] java -version returned 1.6.0_45.
 [04/30/13 17:23:29] [SSH] Starting sftp client.
 [04/30/13 17:23:29] [SSH] Copying latest slave.jar...
 [04/30/13 17:23:29

Re: difficulty connecting to Mac slave

2013-05-01 Thread Dan Tenenbaum
On Wed, May 1, 2013 at 10:04 AM, Dan Tenenbaum danda...@dandante.com wrote:
 On Tue, Apr 30, 2013 at 6:49 PM, Kenny Ayers
 theotherwhitem...@gmail.com wrote:
 You're experiencing at least two issues here.  First there's the OSX bug
 with your window manager permissions.  You need to run headless on OSX, as
 you already determined, so make sure you continue to do that. (The bug is
 reported here: https://issues.jenkins-ci.org/browse/JENKINS-15697).

 Add this to the slave command line options: -Djava.awt.headless=true


 This did the trick.
 Thanks!
 Dan


 Secondarily it seems like perhaps the slave node may not be properly
 configured within Jenkins?  Have you tried a combination of SSH + running
 headless (perhaps that was your error message you included)?



I still have a problem, because I ultimately I want to have a scenario
where the master is in the cloud (EC2) and the Mac slave is on my
internal network, behind a firewall.

So I won't be able to use ssh in this scenario to connect from the
master to the slave.
It sounds like I will have to start the slave agent on the slave.
But that isn't working, even with the headless option to the JVM, I am getting

$ java -Djava.awt.headless=true -jar slave.jar -jnlpUrl
http://dhcp151178:8080/computer/pitt/slave-agent.jnlp -secret secret
hidden
May 1, 2013 2:59:10 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: The server rejected the connection: Unauthorized access
java.lang.Exception: The server rejected the connection: Unauthorized access
at hudson.remoting.Engine.onConnectionRejected(Engine.java:257)
at hudson.remoting.Engine.run(Engine.java:232)

This happens even if I provide the -secret suggested to me on the
slave's page on the master's Jenkins.


I get the same error if I try and start the JNLP from a browser, after
logging in to jenkins on the master as a user with admin rights.

I also downloaded the JNLP manually and tried this:
javaws -Jjava.awt.headless=true slave-agent.jnlp
...but I get:
...
Splash: Can't connect to window server.: No such file or directory
Wed May  1 15:04:49 pitt.fhcrc.org java[349] Error: kCGErrorFailure:
Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are
logged.
Exception in thread main java.lang.InternalError: Can't connect to
window server - not enough permissions.
...

I thought the java.awt.headless switch was supposed to take care of
this. I have added that switch to the master's config of this node.

I *do* now have security on the master, so is there a way to pass a
username/password when I try and invoke the JNLP from the command
line? I assume that's what the -secret option is supposed to do.

I am able to start the slave from the master using both Launch slave
agents on Unix machines via SSH and Launch slave via execution of
command on the Master (using the command ssh jenkins@nameofslave
java -Djava.awt.headless=true -jar
/Users/Shared/Jenkins/Home/war/WEB-INF/slave.jar)

BUT, I cannot establish communication between the slave and master if
the master is outside my network firewall.

There is an ssh gateway and I'll investigate whether tunneling is a
possibility. But I'd like to be able to start the slave agent--that's
my real problem.

Also I'm wondering if there is a way to start the slave agent on the
slave without being logged in. Because what if the slave machine
reboots, there is no guarantee that someone will log into it and start
the appropriate Java Web Start. There is probably a way to automate
that but I'd prefer if the necessary processes ran as daemons so being
logged in was not necessary.

Thanks in advance,
Dan



 I hope this helps,

 Kenny

 On Tuesday, April 30, 2013 5:28:11 PM UTC-7, Dan Tenenbaum wrote:

 Hi all,

 I have tried a number of methods to connect to a Mac slave and have had no
 success.

 My master is also a mac and it's called dhcp151178. The slave I'm trying
 to connect to is called pelham. These of course are machines on my internal
 network.

 The first method I tried was Launch slave agents on Unix machines via
 SSH.

 It looks like the master can connect to the slave via ssh but then I get
 the following (excerpted; full stack traces at end of message):

 java.io.IOException: Remote call on pelham failed

 ...

 Caused by: java.lang.InternalError: Can't connect to window server - not
 enough permissions.


 Then I tried Launch slave agents via Java Web Start

 And on the slave I navigated to
 http://dhcp151178:8080/computer/pelham/slave-agent.jnlp

 This gave me:


 java.lang.Exception: The server rejected the connection: Unauthorized
 access

 at hudson.remoting.Engine.onConnectionRejected(Engine.java:257)

 at hudson.remoting.Engine.run(Engine.java:232)


 Also, based on the following post:


 http://stackoverflow.com/questions/11824486/setting-up-a-hudson-slave-on-windows-xp


 I tried downloading the jnlp file from the URL above, replacing all
 instances of 'localhost' with 'dhcp151178' and launching the jnlp with
 javaws, this either gives me

Re: difficulty connecting to Mac slave

2013-05-01 Thread Dan Tenenbaum
On Wed, May 1, 2013 at 6:48 PM, Kenny Ayers theotherwhitem...@gmail.com wrote:
 Hey Dan,

   I noticed that in part of your reply, you said you had an issue starting
 the slave, but it looks there is a syntax error here:

 I also downloaded the JNLP manually and tried this:

 javaws -Jjava.awt.headless=true slave-agent.jnlp

 ...but I get:

 ...

 Splash: Can't connect to window server.: No such file or directory

 Wed May  1 15:04:49 pitt.fhcrc.org java[349] Error: kCGErrorFailure:

 Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are

 logged.

 Exception in thread main java.lang.InternalError: Can't connect to

 window server - not enough permissions.


   Make sure you use -D, not -J.


For javaws (as opposed to java) the command to pass an option to the
JVM is -J, not -D.


   Setting up an SSH tunnel from the master to slave should be a workaround
 for the security error you're getting.  Any reason your master has to be
 outside of your network in the EC2 cloud (I'm guessing this is part of an
 enterprise support scheme)?


I would like all the build machines to be in EC2 but there are no
virtual Mac machines because of licensing issues, so in order to build
on the Mac I need to contact a machine on our internal network.

   There are a few ways to run a Jenkins slave on startup for OSX.  Here is a
 link describing how to setup the Jenkins service (not slave):
 http://jrenard.info/blog/a-quick-but-working-startup-item-for-hudson-for-mac-os-x.html
 - you should be able to modify the contents of the plist file to run the
 slave service.


OK, so that ensures that the jenkins web app is always running, but
I'm not clear whether that means that the slave will always be running
(and in contact with the master).

   Does the master node have any information in its log when OSX has the
 security crash?

Any idea where I should look? I'm not sure where jenkins' logs are.
The master is running on OSX as well if that helps you answer the
question.


 Have you considered setting up a test instance of Jenkins
 and debugging in real-time?  I realize this is a bit more technical than
 most users want to get, but if you've got some understanding of Java it is
 fairly simple to do using NetBeans:
 https://groups.google.com/forum/?fromgroups=#!topic/jenkinsci-dev/9a4F7jN1JNI


I'll try it if other avenues don't work out.

Thanks,
Dan


 Hope this helps some,

 Kenny


 On Wednesday, May 1, 2013 4:47:46 PM UTC-7, Dan Tenenbaum wrote:

 On Wed, May 1, 2013 at 10:04 AM, Dan Tenenbaum dand...@dandante.com
 wrote:
  On Tue, Apr 30, 2013 at 6:49 PM, Kenny Ayers
  theother...@gmail.com wrote:
  You're experiencing at least two issues here.  First there's the OSX
  bug
  with your window manager permissions.  You need to run headless on OSX,
  as
  you already determined, so make sure you continue to do that. (The bug
  is
  reported here: https://issues.jenkins-ci.org/browse/JENKINS-15697).
 
  Add this to the slave command line options: -Djava.awt.headless=true
 
 
  This did the trick.
  Thanks!
  Dan
 
 
  Secondarily it seems like perhaps the slave node may not be properly
  configured within Jenkins?  Have you tried a combination of SSH +
  running
  headless (perhaps that was your error message you included)?
 


 I still have a problem, because I ultimately I want to have a scenario
 where the master is in the cloud (EC2) and the Mac slave is on my
 internal network, behind a firewall.

 So I won't be able to use ssh in this scenario to connect from the
 master to the slave.
 It sounds like I will have to start the slave agent on the slave.
 But that isn't working, even with the headless option to the JVM, I am
 getting

 $ java -Djava.awt.headless=true -jar slave.jar -jnlpUrl
 http://dhcp151178:8080/computer/pitt/slave-agent.jnlp -secret secret
 hidden
 May 1, 2013 2:59:10 PM hudson.remoting.jnlp.Main$CuiListener error
 SEVERE: The server rejected the connection: Unauthorized access
 java.lang.Exception: The server rejected the connection: Unauthorized
 access
 at hudson.remoting.Engine.onConnectionRejected(Engine.java:257)
 at hudson.remoting.Engine.run(Engine.java:232)

 This happens even if I provide the -secret suggested to me on the
 slave's page on the master's Jenkins.


 I get the same error if I try and start the JNLP from a browser, after
 logging in to jenkins on the master as a user with admin rights.

 I also downloaded the JNLP manually and tried this:
 javaws -Jjava.awt.headless=true slave-agent.jnlp
 ...but I get:
 ...
 Splash: Can't connect to window server.: No such file or directory
 Wed May  1 15:04:49 pitt.fhcrc.org java[349] Error: kCGErrorFailure:
 Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are
 logged.
 Exception in thread main java.lang.InternalError: Can't connect to
 window server - not enough permissions.
 ...

 I thought the java.awt.headless switch was supposed to take care of
 this. I have added that switch to the master's config of this node.

 I

Re: difficulty connecting to Mac slave

2013-04-30 Thread Dan Tenenbaum
On Tue, Apr 30, 2013 at 5:55 PM, Scott Evans milwrd...@gmail.com wrote:
 Dan,

 I'm not a mac person so can't help you in detail, but can you, from your
 mac, browse to your Jenkins server with a web browser?


Yes.

 It almost sounds
 like your slave mac isn't giving the jenkins slave process enough
 permissions to reach out, or there is some sort of firewall blocking
 connections to the jenkins server on port 8080 perhaps.


There is no firewall.


To me it seems like the slave can contact the master, but is having an
authorization problem once it does.

Dan


 Scott


 On Tue, Apr 30, 2013 at 7:28 PM, Dan Tenenbaum danda...@gmail.com wrote:

 Hi all,

 I have tried a number of methods to connect to a Mac slave and have had no
 success.

 My master is also a mac and it's called dhcp151178. The slave I'm trying
 to connect to is called pelham. These of course are machines on my internal
 network.

 The first method I tried was Launch slave agents on Unix machines via
 SSH.

 It looks like the master can connect to the slave via ssh but then I get
 the following (excerpted; full stack traces at end of message):

 java.io.IOException: Remote call on pelham failed

 ...

 Caused by: java.lang.InternalError: Can't connect to window server - not
 enough permissions.


 Then I tried Launch slave agents via Java Web Start

 And on the slave I navigated to
 http://dhcp151178:8080/computer/pelham/slave-agent.jnlp

 This gave me:



 java.lang.Exception: The server rejected the connection: Unauthorized
 access

 at hudson.remoting.Engine.onConnectionRejected(Engine.java:257)

 at hudson.remoting.Engine.run(Engine.java:232)



 Also, based on the following post:


 http://stackoverflow.com/questions/11824486/setting-up-a-hudson-slave-on-windows-xp


 I tried downloading the jnlp file from the URL above, replacing all
 instances of 'localhost' with 'dhcp151178' and launching the jnlp with
 javaws, this either gives me no console output at all (but the slave agent
 gui says Terminated) or it says:


 ...

 Exception in thread main java.lang.InternalError: Can't connect to
 window server - not enough permissions.


 I tried starting in headless mode, both as jenkins and as my regular admin
 user. I did this on the slave:


 java -jar slave.jar -jnlpUrl
 http://dhcp151178:8080/computer/pelham/slave-agent.jnlp
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener init
 INFO: Jenkins agent is running in headless mode.
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener status
 INFO: Locating server among [http://localhost:8080/,
 http://dhcp151178:8080/]
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener status
 INFO: Connecting to localhost:49161
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener status
 INFO: Handshaking
 Apr 30, 2013 5:19:02 PM hudson.remoting.jnlp.Main$CuiListener error
 SEVERE: The server rejected the connection: Unauthorized access
 java.lang.Exception: The server rejected the connection: Unauthorized
 access
 at hudson.remoting.Engine.onConnectionRejected(Engine.java:257)
 at hudson.remoting.Engine.run(Engine.java:232)


 There is no security set up on the master, so I'm not sure what the
 unauthorized access is about, and there is no -auth username:password that I
 can add to that command line.


 I'm not sure how to set up Launch slave via execution of command on the
 Master because I can't find much documentation for that.


 So I'm stuck. I was able to set up a windows slave so I know that it is
 possible. But the Mac slave does not want to start. Can you help?


 Thanks,

 Dan



 Addenda: full stack trace from trying to launch slave agents on the master
 using ssh:


 04/30/13 17:23:29] [SSH] Opening SSH connection to pelham:22.
 [04/30/13 17:23:29] [SSH] Authentication successful.
 [04/30/13 17:23:29] [SSH] The remote users environment is:
 BASH=/bin/bash
 BASH_ARGC=()
 BASH_ARGV=()
 BASH_EXECUTION_STRING=set
 BASH_LINENO=()
 BASH_SOURCE=()
 BASH_VERSINFO=([0]=3 [1]=2 [2]=48 [3]=1 [4]=release
 [5]=x86_64-apple-darwin10.0)
 BASH_VERSION='3.2.48(1)-release'
 DIRSTACK=()
 EUID=216
 GROUPS=()
 HOME=/Users/Shared/Jenkins
 HOSTNAME=pelham.fhcrc.org
 HOSTTYPE=x86_64
 IFS=$' \t\n'
 LOGNAME=jenkins
 MACHTYPE=x86_64-apple-darwin10.0
 MAIL=/var/mail/jenkins
 OPTERR=1
 OPTIND=1
 OSTYPE=darwin10.0
 PATH=/usr/bin:/bin:/usr/sbin:/sbin
 PPID=545
 PS4='+ '
 PWD=/Users/Shared/Jenkins
 SHELL=/bin/bash
 SHELLOPTS=braceexpand:hashall:interactive-comments
 SHLVL=1
 SSH_CLIENT='140.107.151.178 56267 22'
 SSH_CONNECTION='140.107.151.178 56267 140.107.150.101 22'
 TERM=dumb
 UID=216
 USER=jenkins
 _=bash
 [04/30/13 17:23:29] [SSH] Checking java version of java
 [04/30/13 17:23:29] [SSH] java -version returned 1.6.0_45.
 [04/30/13 17:23:29] [SSH] Starting sftp client.
 [04/30/13 17:23:29] [SSH] Copying latest slave.jar...
 [04/30/13 17:23:29] [SSH] Copied 284,251 bytes.
 Expanded the channel window size to 4MB
 [04/30/13 17:23:29] [SSH] Starting slave process: cd
 '/Users