I wrote a very simple Jenkins Library that should execute some stages in a kubernetes POD.
The directory structure is:
├── README.md
├── resources
│ ├── exc
│ │ ├── build.jl
│ │ └── test.jl
│ └── k8s
│ └── my_pod.yaml
├── src
└── vars
└── package_pipeline.groovy
This is the content of package_pipeline.groovy:
#!/usr/bin/env groovy
def call(String package_dir)
{
script {
def pod_yaml = libraryResource "k8s/my_pod.yaml"
podTemplate(cloud: "my-cloud", namespace: "my-namespace", yaml: pod_yaml) {
node(POD_LABEL) {
stage("build") {
container('mycontainername') {
sh "pwd"
}
}
}
}
}
}
This is the contents of Jenkinsfile in the repo that uses the above library:
#!/usr/bin/env groovy
@Library('julia-jenkins-lib@WAIQ-1884')_
package_pipeline('.')
When the pipeline gets executed by Jenkins, I get this error right after the POD is created by Jenkins:
[Bitbucket] Notifying pull request build result
[Bitbucket] Build result notified
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: container.call() is applicable for argument types: (java.lang.String, org.jenkinsci.plugins.workflow.cps.CpsClosure2) values: [julia, org.jenkinsci.plugins.workflow.cps.CpsClosure2@3754983a]
Possible solutions: wait(), any(), run(), run(), find(), dump()
Jenkins version: 2.235.1
What am I doing wrong?