[JIRA] (JENKINS-50312) Build hangs when invalid envVar key is used

6 views
Skip to first unread message

deiwin.sarjas@gmail.com (JIRA)

unread,
Mar 21, 2018, 6:05:02 AM3/21/18
to jenkinsc...@googlegroups.com
Deiwin Sarjas created an issue
 
Jenkins / Improvement JENKINS-50312
Build hangs when invalid envVar key is used
Issue Type: Improvement Improvement
Assignee: Carlos Sanchez
Components: kubernetes-plugin
Created: 2018-03-21 10:04
Environment: Jenkins ver. 2.89.4, Kubernetes plugin 1.3.2
Priority: Minor Minor
Reporter: Deiwin Sarjas

 

Summary

Specifying a containerTemplate with envVars: [envVar(key: 'test.key', value: 'value')] fails (on Kubernetes version <1.8) and user is not notified of the failure.

Description

I was trying to configure an environment variable with a dot (".") in the name (for Elasticsearch, where it's suggested in their documentation) for a containerTemplate, the job didn't fail but also didn't finish. It got stuck at provisioning a pod.

Defining non-C-identifier env variable names did not work prior to Kubernetes version 1.8 and we're using 1.7, so it's expected that the pod creation fails. However, I'd expect the job to also fail and to see an informative error message in the job output.

Currently, the job hangs with the following message:

Still waiting to schedule task
All nodes of label ‘pipeline-docker-build-1748220349’ are offline

When looking at the logs for the plugin, the following logs repeat multiple times, with different suffixes for the pod name:

 

Mar 21, 2018 11:36:53 AM FINE org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud
In provisioning : [pipeline-docker-build-1748220349-zn6bq-dxt2q]
Mar 21, 2018 11:36:53 AM FINE org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher
Creating Pod: pipeline-docker-build-1748220349-zn6bq-dxt2q in namespace jenkins
Mar 21, 2018 11:36:54 AM WARNING org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
Error in provisioning; agent=KubernetesSlave name: pipeline-docker-build-1748220349-zn6bq-dxt2q, template=PodTemplate{, name='pipeline-docker-build-1748220349-zn6bq', namespace='jenkins', label='pipeline-docker-build-1748220349', volumes=[org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume@2fae427c], containers=[ContainerTemplate{..}, ContainerTemplate{name='es', image='docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.2', envVars=[KeyValueEnvVar [getValue()=value, getKey()=test.key]]}, ContainerTemplate{..}, ContainerTemplate{..}]}
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://kubernetes.default.svc.cluster.local/api/v1/namespaces/jenkins/pods. Message: Pod "pipeline-docker-build-1748220349-zn6bq-dxt2q" is invalid: spec.containers[1].env[1].name: Invalid value: "test.key": a valid C identifier must start with alphabetic character or '_', followed by a string of alphanumeric characters or '_' (e.g. 'my_name',  or 'MY_NAME',  or 'MyName', regex used for validation is '[A-Za-z_][A-Za-z0-9_]*'). Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.containers[1].env[1].name, message=Invalid value: "test.key": a valid C identifier must start with alphabetic character or '_', followed by a string of alphanumeric characters or '_' (e.g. 'my_name',  or 'MY_NAME',  or 'MyName', regex used for validation is '[A-Za-z_][A-Za-z0-9_]*'), reason=FieldValueInvalid, additionalProperties={})], group=null, kind=Pod, name=pipeline-docker-build-1748220349-zn6bq-dxt2q, retryAfterSeconds=null, additionalProperties={}), kind=Status, message=Pod "pipeline-docker-build-1748220349-zn6bq-dxt2q" is invalid: spec.containers[1].env[1].name: Invalid value: "test.key": a valid C identifier must start with alphabetic character or '_', followed by a string of alphanumeric characters or '_' (e.g. 'my_name',  or 'MY_NAME',  or 'MyName', regex used for validation is '[A-Za-z_][A-Za-z0-9_]*'), metadata=ListMeta(resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:470)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:409)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:379)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:343)
	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleCreate(OperationSupport.java:226)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleCreate(BaseOperation.java:769)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:356)
	at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:105)
	at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:285)
	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
	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)

 

Mar 21, 2018 11:36:54 AM FINER org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher
Removing Jenkins node: pipeline-docker-build-1748220349-zn6bq-dxt2q

 

Mar 21, 2018 11:36:54 AM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
Terminating Kubernetes instance for agent pipeline-docker-build-1748220349-zn6bq-dxt2q
Mar 21, 2018 11:36:54 AM WARNING org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
Failed to delete pod for agent jenkins/pipeline-docker-build-1748220349-zn6bq-dxt2q: not found

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

jenkins-ci@carlossanchez.eu (JIRA)

unread,
Apr 3, 2018, 11:49:02 AM4/3/18
to jenkinsc...@googlegroups.com
Carlos Sanchez commented on Improvement JENKINS-50312
 
Re: Build hangs when invalid envVar key is used

it works as expected right now, invalid pod definitions are logged but there is no easy way to display in build status/log

jglick@cloudbees.com (JIRA)

unread,
Jul 16, 2019, 3:43:33 PM7/16/19
to jenkinsc...@googlegroups.com
Jesse Glick assigned an issue to Unassigned
 
Change By: Jesse Glick
Assignee: Carlos Sanchez
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
Reply all
Reply to author
Forward
0 new messages