jenkinsci / kubernetes-cd-plugin

A Jenkins plugin to deploy to Kubernetes cluster
MIT License
139 stars 70 forks source link

ERROR: ERROR: Cannot create property=spec for JavaBean=class V1Deployment #123

Closed lgomesd closed 4 years ago

lgomesd commented 4 years ago

Hello, thanks for the great plugin.

I´m running into some problem in my pipeline.

[Pipeline] stage [Pipeline] { (Deploy to Kubernetes) [Pipeline] kubernetesDeploy Starting Kubernetes deployment Loading configuration: ########## ERROR: ERROR: Cannot create property=spec for JavaBean=class V1Deployment { apiVersion: apps/v1 kind: Deployment metadata: class V1ObjectMeta { annotations: null clusterName: null creationTimestamp: null deletionGracePeriodSeconds: null deletionTimestamp: null finalizers: null generateName: null generation: null initializers: null labels: null managedFields: null name: ####### namespace: ############# ownerReferences: null resourceVersion: null selfLink: null uid: null } spec: null status: null } in 'reader', line 1, column 1: apiVersion: apps/v1 ^ Cannot create property=template for JavaBean=class V1DeploymentSpec { minReadySeconds: null paused: null progressDeadlineSeconds: null replicas: 0 revisionHistoryLimit: null selector: null strategy: null template: null } in 'reader', line 7, column 3: replicas: 0 ^ Cannot create property=spec for JavaBean=class V1PodTemplateSpec { metadata: null spec: null } in 'reader', line 9, column 5: spec: ^ Cannot create property=containers for JavaBean=class V1PodSpec { activeDeadlineSeconds: null affinity: null automountServiceAccountToken: null containers: [] dnsConfig: null dnsPolicy: null enableServiceLinks: null hostAliases: null hostIPC: null hostNetwork: null hostPID: null hostname: null imagePullSecrets: null initContainers: null nodeName: null nodeSelector: null preemptionPolicy: null priority: null priorityClassName: null readinessGates: null restartPolicy: null runtimeClassName: null schedulerName: null securityContext: null serviceAccount: null serviceAccountName: null shareProcessNamespace: null subdomain: null terminationGracePeriodSeconds: null tolerations: null volumes: null } in 'reader', line 10, column 7: containers: ^ argument type mismatch in 'reader', line 11, column 9: image: ########## ... ^

in 'reader', line 10, column 7: containers: ^

in 'reader', line 9, column 5: spec: ^

in 'reader', line 7, column 3: replicas: 0 ^

hudson.remoting.ProxyException: Cannot create property=spec for JavaBean=class V1Deployment { apiVersion: apps/v1 kind: Deployment metadata: class V1ObjectMeta { annotations: null clusterName: null creationTimestamp: null deletionGracePeriodSeconds: null deletionTimestamp: null finalizers: null generateName: null generation: null initializers: null labels: null managedFields: null name: ###### namespace: ####### ownerReferences: null resourceVersion: null selfLink: null uid: null } spec: null status: null } in 'reader', line 1, column 1: apiVersion: apps/v1 ^ Cannot create property=template for JavaBean=class V1DeploymentSpec { minReadySeconds: null paused: null progressDeadlineSeconds: null replicas: 0 revisionHistoryLimit: null selector: null strategy: null template: null } in 'reader', line 7, column 3: replicas: 0 ^ Cannot create property=spec for JavaBean=class V1PodTemplateSpec { metadata: null spec: null } in 'reader', line 9, column 5: spec: ^ Cannot create property=containers for JavaBean=class V1PodSpec { activeDeadlineSeconds: null affinity: null automountServiceAccountToken: null containers: [] dnsConfig: null dnsPolicy: null enableServiceLinks: null hostAliases: null hostIPC: null hostNetwork: null hostPID: null hostname: null imagePullSecrets: null initContainers: null nodeName: null nodeSelector: null preemptionPolicy: null priority: null priorityClassName: null readinessGates: null restartPolicy: null runtimeClassName: null schedulerName: null securityContext: null serviceAccount: null serviceAccountName: null shareProcessNamespace: null subdomain: null terminationGracePeriodSeconds: null tolerations: null volumes: null } in 'reader', line 10, column 7: containers: ^ argument type mismatch in 'reader', line 11, column 9: image: ####### ... ^

in 'reader', line 10, column 7: containers: ^

in 'reader', line 9, column 5: spec: ^

in 'reader', line 7, column 3: replicas: 0 ^

at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:270)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:149)
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:309)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:216)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:205)
at io.kubernetes.client.util.Yaml$CustomConstructor.constructObject(Yaml.java:337)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:164)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:148)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:525)
at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:485)
at io.kubernetes.client.util.Yaml.loadAs(Yaml.java:224)
at io.kubernetes.client.util.Yaml.modelMapper(Yaml.java:494)
at io.kubernetes.client.util.Yaml.loadAll(Yaml.java:272)
at com.microsoft.jenkins.kubernetes.wrapper.KubernetesClientWrapper.apply(KubernetesClientWrapper.java:236)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:172)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:124)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:106)
at hudson.FilePath.act(FilePath.java:1162)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:68)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:45)
at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
at com.microsoft.jenkins.kubernetes.KubernetesDeploy.perform(KubernetesDeploy.java:42)
at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:54)
at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:35)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Caused by: hudson.remoting.ProxyException: Cannot create property=template for JavaBean=class V1DeploymentSpec { minReadySeconds: null paused: null progressDeadlineSeconds: null replicas: 0 revisionHistoryLimit: null selector: null strategy: null template: null } in 'reader', line 7, column 3: replicas: 0 ^ Cannot create property=spec for JavaBean=class V1PodTemplateSpec { metadata: null spec: null } in 'reader', line 9, column 5: spec: ^ Cannot create property=containers for JavaBean=class V1PodSpec { activeDeadlineSeconds: null affinity: null automountServiceAccountToken: null containers: [] dnsConfig: null dnsPolicy: null enableServiceLinks: null hostAliases: null hostIPC: null hostNetwork: null hostPID: null hostname: null imagePullSecrets: null initContainers: null nodeName: null nodeSelector: null preemptionPolicy: null priority: null priorityClassName: null readinessGates: null restartPolicy: null runtimeClassName: null schedulerName: null securityContext: null serviceAccount: null serviceAccountName: null shareProcessNamespace: null subdomain: null terminationGracePeriodSeconds: null tolerations: null volumes: null } in 'reader', line 10, column 7: containers: ^ argument type mismatch in 'reader', line 11, column 9: image: ######### ... ^

in 'reader', line 10, column 7: containers: ^

in 'reader', line 9, column 5: spec: ^

at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:270)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:149)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:216)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:205)
at io.kubernetes.client.util.Yaml$CustomConstructor.constructObject(Yaml.java:337)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:247)
... 32 more

Caused by: hudson.remoting.ProxyException: Cannot create property=spec for JavaBean=class V1PodTemplateSpec { metadata: null spec: null } in 'reader', line 9, column 5: spec: ^ Cannot create property=containers for JavaBean=class V1PodSpec { activeDeadlineSeconds: null affinity: null automountServiceAccountToken: null containers: [] dnsConfig: null dnsPolicy: null enableServiceLinks: null hostAliases: null hostIPC: null hostNetwork: null hostPID: null hostname: null imagePullSecrets: null initContainers: null nodeName: null nodeSelector: null preemptionPolicy: null priority: null priorityClassName: null readinessGates: null restartPolicy: null runtimeClassName: null schedulerName: null securityContext: null serviceAccount: null serviceAccountName: null shareProcessNamespace: null subdomain: null terminationGracePeriodSeconds: null tolerations: null volumes: null } in 'reader', line 10, column 7: containers: ^ argument type mismatch in 'reader', line 11, column 9: image: ########## ... ^

in 'reader', line 10, column 7: containers: ^

at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:270)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:149)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:216)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:205)
at io.kubernetes.client.util.Yaml$CustomConstructor.constructObject(Yaml.java:337)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:247)
... 37 more

Caused by: hudson.remoting.ProxyException: Cannot create property=containers for JavaBean=class V1PodSpec { activeDeadlineSeconds: null affinity: null automountServiceAccountToken: null containers: [] dnsConfig: null dnsPolicy: null enableServiceLinks: null hostAliases: null hostIPC: null hostNetwork: null hostPID: null hostname: null imagePullSecrets: null initContainers: null nodeName: null nodeSelector: null preemptionPolicy: null priority: null priorityClassName: null readinessGates: null restartPolicy: null runtimeClassName: null schedulerName: null securityContext: null serviceAccount: null serviceAccountName: null shareProcessNamespace: null subdomain: null terminationGracePeriodSeconds: null tolerations: null volumes: null } in 'reader', line 10, column 7: containers: ^ argument type mismatch in 'reader', line 11, column 9: image: ########## ... ^

at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:270)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:149)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:216)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:205)
at io.kubernetes.client.util.Yaml$CustomConstructor.constructObject(Yaml.java:337)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:247)
... 42 more

Caused by: hudson.remoting.ProxyException: java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.yaml.snakeyaml.introspector.MethodProperty.set(MethodProperty.java:77) at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:263) ... 47 more [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: Kubernetes deployment ended with HasError Finished: FAILURE

My YAML file that I´m trying to deploy to kubernetes

`apiVersion: apps/v1 kind: Deployment metadata: name: ######## namespace: ############### spec: replicas: 0 template: spec: containers: image: ################ imagePullPolicy: IfNotPresent name: jvm ports:

JENKINS FILE

stage('Deploy to Kubernetes') { steps{ kubernetesDeploy ( configs: 'kubernetes/dep-deployment.yaml', kubeconfigId: '##########', enableConfigSubstitution: true ) } } } }