Quantcast

Script behaves differently when run through Jenkins

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Script behaves differently when run through Jenkins

burkhard
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 > /var/www/staging/my_project/releases/20121029223619/REVISION)"
    servers: ["my.staging-server.com"]
    Password: stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    
    *** [deploy:update_code] rolling back
      * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
        servers: ["my.staging-server.com"]
     ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    POST BUILD TASK : FAILURE


It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (`Net::SSH::AuthenticationFailed: not-specified`)?


Does anyone have an idea what might be going wrong here?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Script behaves differently when run through Jenkins

vlatombe
Hi,

you should check that the HOME variable is defined and accessible to the Jenkins process (or to the slave that is executing the task). I remember having the same kind of issue running git clients.

Hope that helps,

Vincent


2012/10/31 Burkhard Reffeling <[hidden email]>
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 > /var/www/staging/my_project/releases/20121029223619/REVISION)"
    servers: ["my.staging-server.com"]
    Password: stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    
    *** [deploy:update_code] rolling back
      * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
        servers: ["my.staging-server.com"]
     ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    POST BUILD TASK : FAILURE


It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (`Net::SSH::AuthenticationFailed: not-specified`)?


Does anyone have an idea what might be going wrong here?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Script behaves differently when run through Jenkins

burkhard
So I added the following line to the top of my script:
  cd $HOME/.ssh && ls -al && cat id_rsa.pub

Looks fine to me:


[workspace] $ /bin/sh -xe /tmp/hudson7533718270802434100.sh
+ cd /var/lib/jenkins/.ssh
+ ls -al
total 24
drwx------ 2 jenkins jenkins 4096 Oct 30 23:48 .
drwxr-xr-x 9 jenkins jenkins 4096 Oct 31 17:34 ..
-rw-rw-r-- 1 jenkins jenkins   43 Oct 30 23:48 config
-rw------- 1 jenkins jenkins 1675 Oct 27 14:09 id_rsa
-rw-r--r-- 1 jenkins jenkins  410 Oct 27 14:09 id_rsa.pub
-rwx------ 1 jenkins jenkins 1306 Oct 28 22:20 known_hosts
+ cat id_rsa.pub
[MY PUBLIC KEY ...]


Burkhard Reffeling

Software Engineer



On 31 October 2012 17:02, Vincent Latombe <[hidden email]> wrote:
Hi,

you should check that the HOME variable is defined and accessible to the Jenkins process (or to the slave that is executing the task). I remember having the same kind of issue running git clients.

Hope that helps,

Vincent



2012/10/31 Burkhard Reffeling <[hidden email]>
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 > /var/www/staging/my_project/releases/20121029223619/REVISION)"
    servers: ["my.staging-server.com"]
    Password: stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    
    *** [deploy:update_code] rolling back
      * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
        servers: ["my.staging-server.com"]
     ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    POST BUILD TASK : FAILURE


It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (`Net::SSH::AuthenticationFailed: not-specified`)?


Does anyone have an idea what might be going wrong here?


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Script behaves differently when run through Jenkins

stephenconnolly
You might want to try out the ssh agent plugin... Though it is a tad rough and ready. It will work if you install tomcat-native on all the build nodes that need the agent

On Wednesday, 31 October 2012, Burkhard Reffeling wrote:
So I added the following line to the top of my script:
  cd $HOME/.ssh && ls -al && cat id_rsa.pub

Looks fine to me:

[workspace] $ /bin/sh -xe /tmp/hudson7533718270802434100.sh
+ cd /var/lib/jenkins/.ssh
+ ls -al
total 24
drwx------ 2 jenkins jenkins 4096 Oct 30 23:48 .
drwxr-xr-x 9 jenkins jenkins 4096 Oct 31 17:34 ..
-rw-rw-r-- 1 jenkins jenkins   43 Oct 30 23:48 config
-rw------- 1 jenkins jenkins 1675 Oct 27 14:09 id_rsa
-rw-r--r-- 1 jenkins jenkins  410 Oct 27 14:09 id_rsa.pub
-rwx------ 1 jenkins jenkins 1306 Oct 28 22:20 known_hosts
+ cat id_rsa.pub
[MY PUBLIC KEY ...]


Burkhard Reffeling

Software Engineer



On 31 October 2012 17:02, Vincent Latombe <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;vincent.latombe@gmail.com&#39;);" target="_blank">vincent.latombe@...> wrote:
Hi,

you should check that the HOME variable is defined and accessible to the Jenkins process (or to the slave that is executing the task). I remember having the same kind of issue running git clients.

Hope that helps,

Vincent



2012/10/31 Burkhard Reffeling <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;burkhard.reffeling@gmail.com&#39;);" target="_blank">burkhard.reffeling@...>
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 > /var/www/staging/my_project/releases/20121029223619/REVISION)"
    servers: ["my.staging-server.com"]
    Password: stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    
    *** [deploy:update_code] rolling back
      * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
        servers: ["my.staging-server.com"]
     ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    POST BUILD TASK : FAILURE


It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (`Net::SSH::AuthenticationFailed: not-specified`)?


Does anyone have an idea what might be going wrong here?


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Script behaves differently when run through Jenkins

stephenconnolly
I actually have the ssh-agent plugin version 0.2 now no-longer requiring tomcat-native (except perhaps on windows)

On 31 October 2012 20:44, Stephen Connolly <[hidden email]> wrote:
You might want to try out the ssh agent plugin... Though it is a tad rough and ready. It will work if you install tomcat-native on all the build nodes that need the agent

On Wednesday, 31 October 2012, Burkhard Reffeling wrote:
So I added the following line to the top of my script:
  cd $HOME/.ssh && ls -al && cat id_rsa.pub

Looks fine to me:

[workspace] $ /bin/sh -xe /tmp/hudson7533718270802434100.sh
+ cd /var/lib/jenkins/.ssh
+ ls -al
total 24
drwx------ 2 jenkins jenkins 4096 Oct 30 23:48 .
drwxr-xr-x 9 jenkins jenkins 4096 Oct 31 17:34 ..
-rw-rw-r-- 1 jenkins jenkins   43 Oct 30 23:48 config
-rw------- 1 jenkins jenkins 1675 Oct 27 14:09 id_rsa
-rw-r--r-- 1 jenkins jenkins  410 Oct 27 14:09 id_rsa.pub
-rwx------ 1 jenkins jenkins 1306 Oct 28 22:20 known_hosts
+ cat id_rsa.pub
[MY PUBLIC KEY ...]


Burkhard Reffeling

Software Engineer



On 31 October 2012 17:02, Vincent Latombe <[hidden email]> wrote:
Hi,

you should check that the HOME variable is defined and accessible to the Jenkins process (or to the slave that is executing the task). I remember having the same kind of issue running git clients.

Hope that helps,

Vincent



2012/10/31 Burkhard Reffeling <[hidden email]>
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 > /var/www/staging/my_project/releases/20121029223619/REVISION)"
    servers: ["my.staging-server.com"]
    Password: stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    
    *** [deploy:update_code] rolling back
      * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
        servers: ["my.staging-server.com"]
     ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    POST BUILD TASK : FAILURE


It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (`Net::SSH::AuthenticationFailed: not-specified`)?


Does anyone have an idea what might be going wrong here?



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Script behaves differently when run through Jenkins

burkhard
Thanks, I'll give it a spin tonight (don't use windows, so shouldn't be a problem)


Burkhard Reffeling

Software Engineer



On 1 November 2012 12:44, Stephen Connolly <[hidden email]> wrote:
I actually have the ssh-agent plugin version 0.2 now no-longer requiring tomcat-native (except perhaps on windows)


On 31 October 2012 20:44, Stephen Connolly <[hidden email]> wrote:
You might want to try out the ssh agent plugin... Though it is a tad rough and ready. It will work if you install tomcat-native on all the build nodes that need the agent

On Wednesday, 31 October 2012, Burkhard Reffeling wrote:
So I added the following line to the top of my script:
  cd $HOME/.ssh && ls -al && cat id_rsa.pub

Looks fine to me:

[workspace] $ /bin/sh -xe /tmp/hudson7533718270802434100.sh
+ cd /var/lib/jenkins/.ssh
+ ls -al
total 24
drwx------ 2 jenkins jenkins 4096 Oct 30 23:48 .
drwxr-xr-x 9 jenkins jenkins 4096 Oct 31 17:34 ..
-rw-rw-r-- 1 jenkins jenkins   43 Oct 30 23:48 config
-rw------- 1 jenkins jenkins 1675 Oct 27 14:09 id_rsa
-rw-r--r-- 1 jenkins jenkins  410 Oct 27 14:09 id_rsa.pub
-rwx------ 1 jenkins jenkins 1306 Oct 28 22:20 known_hosts
+ cat id_rsa.pub
[MY PUBLIC KEY ...]


Burkhard Reffeling

Software Engineer



On 31 October 2012 17:02, Vincent Latombe <[hidden email]> wrote:
Hi,

you should check that the HOME variable is defined and accessible to the Jenkins process (or to the slave that is executing the task). I remember having the same kind of issue running git clients.

Hope that helps,

Vincent



2012/10/31 Burkhard Reffeling <[hidden email]>
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 > /var/www/staging/my_project/releases/20121029223619/REVISION)"
    servers: ["my.staging-server.com"]
    Password: stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    
    *** [deploy:update_code] rolling back
      * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
        servers: ["my.staging-server.com"]
     ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    POST BUILD TASK : FAILURE


It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (`Net::SSH::AuthenticationFailed: not-specified`)?


Does anyone have an idea what might be going wrong here?




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Script behaves differently when run through Jenkins

stephenconnolly
In reply to this post by stephenconnolly
decided to call it 1.0 ;-)

On 1 November 2012 12:44, Stephen Connolly <[hidden email]> wrote:
I actually have the ssh-agent plugin version 0.2 now no-longer requiring tomcat-native (except perhaps on windows)


On 31 October 2012 20:44, Stephen Connolly <[hidden email]> wrote:
You might want to try out the ssh agent plugin... Though it is a tad rough and ready. It will work if you install tomcat-native on all the build nodes that need the agent

On Wednesday, 31 October 2012, Burkhard Reffeling wrote:
So I added the following line to the top of my script:
  cd $HOME/.ssh && ls -al && cat id_rsa.pub

Looks fine to me:

[workspace] $ /bin/sh -xe /tmp/hudson7533718270802434100.sh
+ cd /var/lib/jenkins/.ssh
+ ls -al
total 24
drwx------ 2 jenkins jenkins 4096 Oct 30 23:48 .
drwxr-xr-x 9 jenkins jenkins 4096 Oct 31 17:34 ..
-rw-rw-r-- 1 jenkins jenkins   43 Oct 30 23:48 config
-rw------- 1 jenkins jenkins 1675 Oct 27 14:09 id_rsa
-rw-r--r-- 1 jenkins jenkins  410 Oct 27 14:09 id_rsa.pub
-rwx------ 1 jenkins jenkins 1306 Oct 28 22:20 known_hosts
+ cat id_rsa.pub
[MY PUBLIC KEY ...]


Burkhard Reffeling

Software Engineer



On 31 October 2012 17:02, Vincent Latombe <[hidden email]> wrote:
Hi,

you should check that the HOME variable is defined and accessible to the Jenkins process (or to the slave that is executing the task). I remember having the same kind of issue running git clients.

Hope that helps,

Vincent



2012/10/31 Burkhard Reffeling <[hidden email]>
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 > /var/www/staging/my_project/releases/20121029223619/REVISION)"
    servers: ["my.staging-server.com"]
    Password: stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    
    *** [deploy:update_code] rolling back
      * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
        servers: ["my.staging-server.com"]
     ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    POST BUILD TASK : FAILURE


It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (`Net::SSH::AuthenticationFailed: not-specified`)?


Does anyone have an idea what might be going wrong here?




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Script behaves differently when run through Jenkins

burkhard
Haha ;) I've got version 1.0 and am getting:

FATAL: [ssh-agent] Unable to start agent
java.lang.UnsatisfiedLinkError: no tcnative-1 in java.library.path, no libtcnative-1 in java.library.path(/usr/lib/jvm/java-6-oracle/jre/lib/i386/server:/usr/lib/jvm/java-6-oracle/jre/lib/i386:/usr/lib/jvm/java-6-oracle/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib)
	at org.apache.tomcat.jni.Library.<init>(Library.java:56)
	at org.apache.tomcat.jni.Library.initialize(Library.java:157)
	at org.apache.sshd.agent.unix.AprLibrary.<init>(AprLibrary.java:83)
	at org.apache.sshd.agent.unix.AprLibrary.initialize(AprLibrary.java:62)
	at org.apache.sshd.agent.unix.AprLibrary.createLocalSocketAddress(AprLibrary.java:109)
	at org.apache.sshd.agent.unix.AgentServer.start(AgentServer.java:57)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentImpl.<init>(SSHAgentBuildWrapper.java:220)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentStarter.call(SSHAgentBuildWrapper.java:288)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentStarter.call(SSHAgentBuildWrapper.java:269)
	at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$SSHAgentEnvironment.<init>(SSHAgentBuildWrapper.java:312)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.setUp(SSHAgentBuildWrapper.java:106)
	at hudson.model.Build$RunnerImpl.doRun(Build.java:133)
	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:480)
	at hudson.model.Run.run(Run.java:1438)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
	at hudson.model.ResourceController.execute(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:239)


Looks like I might still need tomcat-native?


Burkhard Reffeling

Software Engineer



On 1 November 2012 13:32, Stephen Connolly <[hidden email]> wrote:
decided to call it 1.0 ;-)


On 1 November 2012 12:44, Stephen Connolly <[hidden email]> wrote:
I actually have the ssh-agent plugin version 0.2 now no-longer requiring tomcat-native (except perhaps on windows)


On 31 October 2012 20:44, Stephen Connolly <[hidden email]> wrote:
You might want to try out the ssh agent plugin... Though it is a tad rough and ready. It will work if you install tomcat-native on all the build nodes that need the agent

On Wednesday, 31 October 2012, Burkhard Reffeling wrote:
So I added the following line to the top of my script:
  cd $HOME/.ssh && ls -al && cat id_rsa.pub

Looks fine to me:

[workspace] $ /bin/sh -xe /tmp/hudson7533718270802434100.sh
+ cd /var/lib/jenkins/.ssh
+ ls -al
total 24
drwx------ 2 jenkins jenkins 4096 Oct 30 23:48 .
drwxr-xr-x 9 jenkins jenkins 4096 Oct 31 17:34 ..
-rw-rw-r-- 1 jenkins jenkins   43 Oct 30 23:48 config
-rw------- 1 jenkins jenkins 1675 Oct 27 14:09 id_rsa
-rw-r--r-- 1 jenkins jenkins  410 Oct 27 14:09 id_rsa.pub
-rwx------ 1 jenkins jenkins 1306 Oct 28 22:20 known_hosts
+ cat id_rsa.pub
[MY PUBLIC KEY ...]


Burkhard Reffeling

Software Engineer



On 31 October 2012 17:02, Vincent Latombe <[hidden email]> wrote:
Hi,

you should check that the HOME variable is defined and accessible to the Jenkins process (or to the slave that is executing the task). I remember having the same kind of issue running git clients.

Hope that helps,

Vincent



2012/10/31 Burkhard Reffeling <[hidden email]>
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 > /var/www/staging/my_project/releases/20121029223619/REVISION)"
    servers: ["my.staging-server.com"]
    Password: stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    
    *** [deploy:update_code] rolling back
      * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
        servers: ["my.staging-server.com"]
     ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    POST BUILD TASK : FAILURE


It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (`Net::SSH::AuthenticationFailed: not-specified`)?


Does anyone have an idea what might be going wrong here?





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Script behaves differently when run through Jenkins

burkhard
After downgrading to 0.1 and installing tomcat native (which was fun!) I got this:


[ssh-agent] Using credentials jenkins
FATAL: [ssh-agent] Unable to start agent
java.lang.NullPointerException
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentStarter.call(SSHAgentBuildWrapper.java:288)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentStarter.call(SSHAgentBuildWrapper.java:269)
	at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$SSHAgentEnvironment.<init>(SSHAgentBuildWrapper.java:312)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.setUp(SSHAgentBuildWrapper.java:106)
	at hudson.model.Build$RunnerImpl.doRun(Build.java:133)
	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:480)
	at hudson.model.Run.run(Run.java:1438)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
	at hudson.model.ResourceController.execute(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:239)


Burkhard Reffeling

Software Engineer



On 1 November 2012 17:51, Burkhard Reffeling <[hidden email]> wrote:
Haha ;) I've got version 1.0 and am getting:

FATAL: [ssh-agent] Unable to start agent
java.lang.UnsatisfiedLinkError: no tcnative-1 in java.library.path, no libtcnative-1 in java.library.path(/usr/lib/jvm/java-6-oracle/jre/lib/i386/server:/usr/lib/jvm/java-6-oracle/jre/lib/i386:/usr/lib/jvm/java-6-oracle/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib)
	at org.apache.tomcat.jni.Library.<init>(Library.java:56)
	at org.apache.tomcat.jni.Library.initialize(Library.java:157)
	at org.apache.sshd.agent.unix.AprLibrary.<init>(AprLibrary.java:83)
	at org.apache.sshd.agent.unix.AprLibrary.initialize(AprLibrary.java:62)
	at org.apache.sshd.agent.unix.AprLibrary.createLocalSocketAddress(AprLibrary.java:109)
	at org.apache.sshd.agent.unix.AgentServer.start(AgentServer.java:57)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentImpl.<init>(SSHAgentBuildWrapper.java:220)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentStarter.call(SSHAgentBuildWrapper.java:288)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentStarter.call(SSHAgentBuildWrapper.java:269)
	at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$SSHAgentEnvironment.<init>(SSHAgentBuildWrapper.java:312)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.setUp(SSHAgentBuildWrapper.java:106)
	at hudson.model.Build$RunnerImpl.doRun(Build.java:133)
	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:480)
	at hudson.model.Run.run(Run.java:1438)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
	at hudson.model.ResourceController.execute(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:239)


Looks like I might still need tomcat-native?


Burkhard Reffeling

Software Engineer



On 1 November 2012 13:32, Stephen Connolly <[hidden email]> wrote:
decided to call it 1.0 ;-)


On 1 November 2012 12:44, Stephen Connolly <[hidden email]> wrote:
I actually have the ssh-agent plugin version 0.2 now no-longer requiring tomcat-native (except perhaps on windows)


On 31 October 2012 20:44, Stephen Connolly <[hidden email]> wrote:
You might want to try out the ssh agent plugin... Though it is a tad rough and ready. It will work if you install tomcat-native on all the build nodes that need the agent

On Wednesday, 31 October 2012, Burkhard Reffeling wrote:
So I added the following line to the top of my script:
  cd $HOME/.ssh && ls -al && cat id_rsa.pub

Looks fine to me:

[workspace] $ /bin/sh -xe /tmp/hudson7533718270802434100.sh
+ cd /var/lib/jenkins/.ssh
+ ls -al
total 24
drwx------ 2 jenkins jenkins 4096 Oct 30 23:48 .
drwxr-xr-x 9 jenkins jenkins 4096 Oct 31 17:34 ..
-rw-rw-r-- 1 jenkins jenkins   43 Oct 30 23:48 config
-rw------- 1 jenkins jenkins 1675 Oct 27 14:09 id_rsa
-rw-r--r-- 1 jenkins jenkins  410 Oct 27 14:09 id_rsa.pub
-rwx------ 1 jenkins jenkins 1306 Oct 28 22:20 known_hosts
+ cat id_rsa.pub
[MY PUBLIC KEY ...]


Burkhard Reffeling

Software Engineer



On 31 October 2012 17:02, Vincent Latombe <[hidden email]> wrote:
Hi,

you should check that the HOME variable is defined and accessible to the Jenkins process (or to the slave that is executing the task). I remember having the same kind of issue running git clients.

Hope that helps,

Vincent



2012/10/31 Burkhard Reffeling <[hidden email]>
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 > /var/www/staging/my_project/releases/20121029223619/REVISION)"
    servers: ["my.staging-server.com"]
    Password: stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    stty: standard input: Inappropriate ioctl for device
    
    *** [deploy:update_code] rolling back
      * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
        servers: ["my.staging-server.com"]
     ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
    POST BUILD TASK : FAILURE


It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (`Net::SSH::AuthenticationFailed: not-specified`)?


Does anyone have an idea what might be going wrong here?






Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Script behaves differently when run through Jenkins

stephenconnolly
In reply to this post by burkhard
You shouldn't. Can you send some more details of the node that the job is running on (os & java version)

Downgrading to 0.1 will be less useful as the tomcat-native code is still there, just only used as a last resort if the JNR tricks dont

Can you send the full portion of the console log that has each line prefixed with [ssh-agent] and I might be able to diagnose from there.

If you don't feel comfortable sharing your console log with this list, you can send it to Stephen dot Alan dot Connolly at gmail dot com

Thanks.

Sent from a phone

On Thursday, 1 November 2012, Burkhard Reffeling wrote:
Haha ;) I've got version 1.0 and am getting:

FATAL: [ssh-agent] Unable to start agent
java.lang.UnsatisfiedLinkError: no tcnative-1 in java.library.path, no libtcnative-1 in java.library.path(/usr/lib/jvm/java-6-oracle/jre/lib/i386/server:/usr/lib/jvm/java-6-oracle/jre/lib/i386:/usr/lib/jvm/java-6-oracle/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib)
	at org.apache.tomcat.jni.Library.<init>(Library.java:56)
	at org.apache.tomcat.jni.Library.initialize(Library.java:157)
	at org.apache.sshd.agent.unix.AprLibrary.<init>(AprLibrary.java:83)
	at org.apache.sshd.agent.unix.AprLibrary.initialize(AprLibrary.java:62)
	at org.apache.sshd.agent.unix.AprLibrary.createLocalSocketAddress(AprLibrary.java:109)
	at org.apache.sshd.agent.unix.AgentServer.start(AgentServer.java:57)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentImpl.<init>(SSHAgentBuildWrapper.java:220)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentStarter.call(SSHAgentBuildWrapper.java:288)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$RemoteAgentStarter.call(SSHAgentBuildWrapper.java:269)
	at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$SSHAgentEnvironment.<init>(SSHAgentBuildWrapper.java:312)
	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.setUp(SSHAgentBuildWrapper.java:106)
	at hudson.model.Build$RunnerImpl.doRun(Build.java:133)
	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:480)
	at hudson.model.Run.run(Run.java:1438)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
	at hudson.model.ResourceController.execute(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:239)


Looks like I might still need tomcat-native?


Burkhard Reffeling

Software Engineer



On 1 November 2012 13:32, Stephen Connolly <[hidden email]> wrote:
decided to call it 1.0 ;-)


On 1 November 2012 12:44, Stephen Connolly <[hidden email]> wrote:
I actually have the ssh-agent plugin version 0.2 now no-longer requiring tomcat-native (except perhaps on windows)


On 31 October 2012 20:44, Stephen Connolly <[hidden email]> wrote:
You might want to try out the ssh agent plugin... Though it is a tad rough and ready. It will work if you install tomcat-native on all the build nodes that need the agent

On Wednesday, 31 October 2012, Burkhard Reffeling wrote:
So I added the following line to the top of my script:
  cd $HOME/.ssh && ls -al && cat id_rsa.pub

Looks fine to me:

[workspace] $ /bin/sh -xe /tmp/hudson7533718270802434100.sh
+ cd /var/lib/jenkins/.ssh
+ ls -al
total 24
drwx------ 2 jenkins jenkins 4096 Oct 30 23:48 .
drwxr-xr-x 9 jenkins jenkins 4096 Oct 31 17:34 ..
-rw-rw-r-- 1 jenkins jenkins   43 Oct 30 23:48 config
-rw------- 1 jenkins jenkins 1675 Oct 27 14:09 id_rsa
-rw-r--r-- 1 jenkins jenkins  410 Oct 27 14:09 id_rsa.pub
-rwx------ 1 jenkins jenkins 1306 Oct 28 22:20 known_hosts
+ cat id_rsa.pub
[MY PUBLIC KEY ...]


Burkhard Reffeling

Software Engineer



On 31 October 2012 17:02, Vincent Latombe <[hidden email]> wrote:
Hi,

you should check that the HOME variable is defined and accessible to the Jenkins process (or to the slave that is executing the task). I remember having the same kind of issue running git clients.

Hope that helps,

Vincent



2012/10/31 Burkhard Reffeling <[hidden email]>
Hi all,

I've got a Jenkins build that runs a Capistrano deploy as a post-build action.
 
Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).

    [workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
    Performing Post build task...
    Match found for : : True
    Logical operation result is TRUE
    Running script  : cap _2.13.4_ deploy
    [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
    + cap _2.13.4_ deploy
      * executing `deploy'
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        triggering before callbacks for `deploy:update_code'
    [32m--> Updating code base with checkout strategy[0m
        executing locally: "git ls-remote [hidden email]:my_project.git master"
        command finished in 1200ms
      * executing "git clone -q [hidden email]:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd /var/www/staging/my_project/releases/20121029223619 && git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 && (echo 1fb11d66
Loading...