there's a typo in the example
defaultContainer: 'jnlp'
should be
defaultContainer 'jnlp'
see https://github.com/jenkinsci/kubernetes-plugin/pull/316

On Thu, Apr 26, 2018 at 8:42 AM Ram Kamath <[email protected]>
wrote:

> Dear Jenkins Users,
>
> I am trying to make use of the pod creation with yaml feature introduced
> in V1.6. I am using the example pipeline on the GitHub page [HERE]
> <https://github.com/jenkinsci/kubernetes-plugin>. I always get an
> exception. Could anybody shed some light on my possible mistake?
>
> my jenkinsfile is
> pipeline {
>   agent {
>     kubernetes {
>       label 'mypod'
>       defaultContainer: 'jnlp'
>       yaml """
> apiVersion: v1
> kind: Pod
> metadata:
>   labels:
>     app: test
> spec:
>   containers:
>   - name: maven
>     image: maven:alpine
>     command:
>     - cat
>     tty: true
>   - name: busybox
>     image: busybox
>     command:
>     - cat
>     tty: true
> """
>     }
>   }
>   stages {
>     stage('Run maven') {
>       steps {
>         container('maven') {
>           sh 'mvn -version'
>         }
>         container('busybox') {
>           sh '/bin/busybox'
>         }
>       }
>     }
>   }
> }
>
> And the exception is
>
> Obtained Jenkinsfile from 890534edc3963a758f650fb2a5d0bcea77869b86
> Running in Durability level: MAX_SURVIVABILITY
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> WorkflowScript: 3: Expected to find someKey "someValue" @ line 3, column 16.
>        kubernetes {
>                   ^
>
> 1 error
>
>         at 
> org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
>         at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
>         at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
>         at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
>         at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
>         at 
> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
>         at 
> groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
>         at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
>         at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:133)
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:559)
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:520)
>         at 
> org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:323)
>         at hudson.model.ResourceController.execute(ResourceController.java:97)
>         at hudson.model.Executor.run(Executor.java:429)
> Finished: FAILURE
>
>
> I am using plugin version 1.6 and Jenkins 2.107.2
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/3b15c9ce-1b35-4171-9ab1-63a0286e1867%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/3b15c9ce-1b35-4171-9ab1-63a0286e1867%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CALHFn6NxbH9iZLZHM13vH%2BYv-uWwzksYTV9aKna%3DkQ-RcHo_-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to