Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-60517] Add null check for containerWorkingDirFilePath #671

Merged
merged 3 commits into from
Jan 6, 2020
Merged

[JENKINS-60517] Add null check for containerWorkingDirFilePath #671

merged 3 commits into from
Jan 6, 2020

Conversation

narayanan
Copy link
Contributor

NPE happens when shell command gets executed inside a dynamically created container inside a DIND container. As this shell command is getting executed with in a container created outside of kubernetes pod, container working directory is getting set to null. Added a null check to avoid NPE.

Check https://issues.jenkins-ci.org/browse/JENKINS-60517 for more details

@k2glyph
Copy link

k2glyph commented Jan 2, 2020

java.lang.NullPointerException
	at org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator$1.launch(ContainerExecDecorator.java:267)
	at hudson.Launcher$ProcStarter.start(Launcher.java:455)
	at hudson.Launcher$ProcStarter.join(Launcher.java:466)
	at org.jenkinsci.plugins.docker.commons.impl.RegistryKeyMaterialFactory.materialize(RegistryKeyMaterialFactory.java:101)
	at org.jenkinsci.plugins.docker.workflow.AbstractEndpointStepExecution2.doStart(AbstractEndpointStepExecution2.java:53)
	at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:77)
	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)

@narayanan
Copy link
Contributor Author

narayanan commented Jan 2, 2020

@k2glyph This is the same exception reported in the jenkins issue which was addressed as part of this PR. Do you still see the issue with the changes in this PR? If so, a sample JenkinsFile to reproduce the issue would help reproducing the issue.

@Vlatombe Vlatombe added the bug Bug Fixes label Jan 6, 2020
@Vlatombe Vlatombe merged commit 1ac81b8 into jenkinsci:master Jan 6, 2020
@narayanan narayanan deleted the JENKINS-60517 branch January 6, 2020 18:07
assertFalse(templates.isEmpty());
PodTemplate template = templates.get(0);
assertEquals(Integer.MAX_VALUE, template.getInstanceCap());
r.assertBuildStatusSuccess(r.waitForCompletion(b));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently failing for me locally in Microk8s (noticed while testing #1083); the build fails in docker run with

docker: Error response from daemon: cgroups: cgroup mountpoint does not exist: unknown.

Perhaps because Microk8s is now using cgroup v2, and docker:19-dind is assuming v1? Need to figure out how to Assume that the environment is capable of running DinD pods, at least with the specified image version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also failing locally when I run tests in #1275, but apparently not in CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants