Trying to execute a simple .sh file from ssh plugin


Ive been trying the following:

task myTask() << {
    host = urlMongoDbParam
    user = tomcatLoginName
    password = tomcatPassword
    host = urlMySqlDbParam
    user = tomcatLoginName
    password = tomcatPassword

session(remotes.mySQLServer) {

This not working for me. i get the following message:

[Step 1/1] Process exited with code 1
[16:38:56][Step 1/1] Gradle failure report
[16:38:56]FAILURE: Build failed with an exception.
[16:38:56]* Where:
[16:38:56]Script '/var/lib/TeamCity/buildAgent/work/bd8676a4734a8b09/MyProj/deploy.gradle' line: 582
[16:38:56]* What went wrong:
[16:38:56]Execution failed for task ':myTask'.
[16:38:56]> Cannot invoke method call() on null object

Any ideas why? (p.s the sh file is executed easily in the actual machine itself.)

I assume you are trying to use this plugin. I believe the remotes { } block needs to go in the root of you build script instead of inside your task’s task action.