-
Bug
-
Resolution: Unresolved
-
Minor
-
Jenkins 2.387.3
Kubernetes
Version3937.vd7b_82db_e347b_
Image jenkins/jenkins:2.387.3
"java.lang.NoSuchMethodError: No such DSL method 'when' found among steps" is shown if I want to use the when directive. This way making impossible to work with Multibranch SCM projects.
example:
```
podTemplate(
label: 'jenkins-jenkins-agent', cloud: 'kubernetes', namespace: 'default',
yaml: """
spec:
hostAliases:
- ip: xx.xxx.xxx.xx
hostnames:
- "xxxxx"
- "xxxx"
""",
nodeSelector: 'Nodegroup=xxxx',
envVars : [
envVar(key: 'ECR_REPO', value: 'dff/staging/jenkins'),
envVar(key: 'ECR_ENDPOINT', value: 'xxxxxxxx'),
envVar(key: 'CLUSTER_NAME', value: 'xxxxxx'),
envVar(key: 'BUILD_REPO', value: 'cloud-jenkins'),
envVar(key: 'K8S_YAML_REPO', value: 'cloud-k8s-apps'),
envVar(key: 'BUILD_NUMBER', value: "${BUILD_NUMBER}"),
envVar(key: 'BRANCH_NAME', value: "${BRANCH_NAME}"),
envVar(key: 'AWS_DEFAULT_REGION', value: 'us-east-2'),
secretEnvVar(key: 'AWS_ACCESS_KEY_ID', secretName: 'aws-secret', secretKey: 'AWS_ACCESS_KEY_ID'),
secretEnvVar(key: 'AWS_SECRET_ACCESS_KEY', secretName: 'aws-secret', secretKey: 'AWS_SECRET_ACCESS_KEY')
],
containers: [
containerTemplate(
name: 'unzip',
image: 'xxxxxx',
ttyEnabled: true,
command: 'sleep',
args: '9999'
)
],
volumes: [
configMapVolume(configMapName: 'docker-config', mountPath: '/root/.docker')
],
) {
node('jenkins-jenkins-agent') {
stage('Preparation') {
when
container('unzip') {
git branch: 'staging', url: 'https://socgit.advantest.com/bitbucket/scm/acs-datalake/cloud-jenkins.git', credentialsId: 'xxxx'
sh """
git branch -D ${BRANCH_NAME} || true
"""
}
}
}
}
```
Is there any other way to develop Multibranch SCM pipelines using the kubernetes plugin??