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 <[email protected]> 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 <[email protected]>
>
>> 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 
>>> [email protected]:my_project.git
>>> master"
>>>         command finished in 1200ms
>>>       * executing "git clone -q [email protected]: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 via email to