Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

ssh task configuration gives error while running powershell script.

Mahesh
Contributor
November 19, 2024

Hi,

I am using ssh task configuration for running my script which will install exe file.

I am able to run the scripts locally/manually in the remote server. But from Bamboo I am seeing failures.

 

 

Command for local and bamboo : powershell -ExecutionPolicy Bypass -File "app-install.ps1"

Error :

 

 

Starting task 'Install Application' of type 'com.atlassian.bamboo.plugins.bamboo-scp-plugin:sshtask'
simple	19-Nov-2024 09:26:40	The task will be executed on the following hosts: host-name
simple	19-Nov-2024 09:26:40	Connecting to "host-name" on port: 22
simple	19-Nov-2024 09:26:41	[host: host-name] Executing [powershell -ExecutionPolicy Bypass -File "app-install.ps1"]
simple	19-Nov-2024 09:26:41	Can't propagate "bamboo_*" environment variables. See http://docs.atlassian.com/bamboo/docs-0902/Using+the+SSH+task+in+Bamboo how to configure destination host
error	19-Nov-2024 09:28:06	C:\Users\my-user\app-install.ps1: Installation failed. Exit code: 
error	19-Nov-2024 09:28:06	    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
error	19-Nov-2024 09:28:06	    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,app-install.ps1
error	19-Nov-2024 09:28:06	 
simple	19-Nov-2024 09:28:06	[host: host-name] [powershell -ExecutionPolicy Bypass -File "app-install.ps1"] has finished.
simple	19-Nov-2024 09:28:06	[host: host-name] Result: exit code = 0
simple	19-Nov-2024 09:28:06	Finished task 'Install application' with result: Success

1 answer

0 votes
Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 19, 2024

Hi @Mahesh 

I'm not sure whether this line blocks this 

Can't propagate "bamboo_*" environment variables.

But you can enable your remote host to accept the variables by editing /etc/ssh/sshd_config. This is the procedure.

Have you tried to manually ssh into the remote but from the Bamboo agent machine? And with the user running your agent.
For me this is always the first step in troubleshooting these kinds of issues.

Mahesh
Contributor
November 19, 2024

Hi @Charlie Misonne , Thanks for your reply !!.
Yes I am able to do ssh to the remote agent from Bamboo build agent using the user which I am mentioning in the task.

Also the remote agent is windows machine so, sshd_config is not there.

And that warning will not harm i feel.

Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 21, 2024

Well the sshd_config  should be adapted on your target machine, not on the Bamboo machine agent machine.
I asumme your target is Linux?

Any chance your app-install script is able to log more verbose output to pinpoint the issue?

Mahesh
Contributor
November 21, 2024

No My target is windows.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events