So I have a jenkins pipeline which connects to the server and I would like it to define some env variables that are referencing some env variables from jenkins.
To connect to the server I am using sshCommand plugin:
def remote = [name: 'something', host : '${HOST}', password: '${PASSWORD}'] pipeline { agent any stages { stage('env var'){ steps { sshCommand remote: remote, command: 'export ENV1=${env.ENV1}' } } } } However it outputs constantly the following error:
groovy.lang.MissingPropertyException: No such property: remote for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63) Any ideas on where is this error coming from?
remotevariable without thedefkeyword. See the answer to the following question for further details.