java.lang.NoSuchMethodError: No such DSL method 'sshagent' found among steps?

Viewed 3779

In my Jenkins declarative pipeline I have the following:

 pipeline {

   stages {
     stage('Checkout') {
       // clone using git
     }
     stage('Merge') {
       // need to merge dev to master
       merge()
     }
  }
}

def merge() {
  sshagent(credentials : ['git-credentials-id']) {
  sh "git push origin master"
}

when running the pipeline I get the following exception:

java.lang.NoSuchMethodError: No such DSL method 'sshagent' found among steps?
1 Answers
Related