Tunneling SSH in pipeline error: Bind: Cannot assign requested address

Cesare Vairetti February 14, 2019

Hi,

 my pipeline is this:

image: redwolfgang20/grails:latest

pipelines:
default:
- step:
name: Build war Tunneling and Pushing
script:
- grails prod war
- ssh -t -L 18081:localhost:8080 root@IP -fN
- cd build/libs/
- INPUT=$(ls -t *".war" | head -n 1)
- name=$(echo "$INPUT" | cut -f 1 -d '.')
- curl -v -u $TOMCAT_USER:$TOMCAT_PASSWORD -T build/libs/$name.war http://localhost:18081/manager/text/deploy?path=/'$name'&update=true

the first time I run it it worked, even if the curl line was a bit different. After everytime I run it I got this:

+ ssh -t -L 18081:localhost:8080 root@IP -fN
bind: Cannot assign requested address

 

I have no idea how to fix it, please advice

 

thanks

cesare

 

UPDATE

 

I change ssh tunnel command with this and it seems to work:

ssh -fN root@IP -L *:18080:localhost:8080

but now my curl command does not return nothing it seems it does anything at all even wtih --trace parameter

1 answer

0 votes
Graham Gatus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2019

@Cesare Vairetti I did some research and tried to reproduce that bind error locally, and it seems it is due to ssh trying to bind to an IPv6 address. Even with this warning however, I could still tunnel successfully.

I was able to stop this warning by passing the '-4' arg to ssh, and added the '-v' flag to enable additional debugging information.

ssh -v -4 -t -L 18081:localhost:8080 <user>@<my-host> -

I was able to tunnel through to a remote instance running nginx multiple times without any issue from pipelines.

It might be worth checking after deploying your .war file that port 8080 is still listening on the remote server?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events