Kubernetes plugin + vanilla node/agent - classcast exception

13 views
Skip to first unread message

David Karlsen

unread,
May 7, 2020, 10:02:26 AM5/7/20
to Jenkins Users
I have a pipeline which uses the Kubernetes Jenkins plugin:

pipeline {
  agent {
    kubernetes {
      cloud 'icp-global'
      defaultContainer 'node'
      // customWorkspace '/workspace'
      yamlFile 'buildPod.yaml'
    }

but would like to run another step outside of containers, like:
  stage('deploy') {
      steps {
        node('rhel7') { <-- outside of k8s
          sh '''
            do the thing
          '''
        }
      }
    }

But I get:
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
java.lang.ClassCastException: hudson.plugins.swarm.SwarmSlave cannot be cast to org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave
	at org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator$1.launch(ContainerExecDecorator.java:250)
	at hudson.Launcher$ProcStarter.start(Launcher.java:455)
	at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:233)
	at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoring

Is this not supported?
--

Liejun Tao

unread,
May 7, 2020, 11:23:38 PM5/7/20
to jenkins...@googlegroups.com
You may start the pipeline with agent none, the do one stage with the k8s node, another stage with the other node.



--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGO7Ob2Fn-LYv42_WKPNU39-TN79q%3DKiP4_rmaWO%3DN9Zpn5Qhw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages