Hey all,
I’m trying to make shared steps between two pipelines but it doesn’t seem to be properly loading1
What I tried to do (all the files in the same repository/clone):
// vars/submodules.groovy
def call() {
sh 'git pull'
sh 'git submodule update --init'
sh 'git submodule status'
}
And my pipeline
// Jenkinsfile
pipeline {
agent { ... }
options { ... }
stages {
stage('Submodules') {
steps {
submodules()
}
}
}
}
But every time the pipeline runs, I get an error about the submodules call:
java.lang.NoSuchMethodError: No such DSL method 'submodules' found among steps [archive, ...]
What’s the proper way to split steps this way? Is there a plugin that needs to be present to make this work automatically? We are using Jenkins 2.440.3.
1: Actually, I’m breaking my current pipeline into smaller calls to be reused in a new one.