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

[FIXED JENKINS-52259] Add yamlFile option for Declarative agent #355

Merged
merged 10 commits into from
Jul 11, 2018

Conversation

abayer
Copy link
Member

@abayer abayer commented Jun 28, 2018

JENKINS-52259

If given, it'll read from the specified file via readTrusted and use
that for the yaml to pass on.

I don't have a local k8s env on my laptop so I haven't actually tested this yet. =)

abayer and others added 4 commits June 28, 2018 15:08
@carlossg
Copy link
Contributor

this is the error I'm getting trying to build examples/declarative_from_yaml_file

Started by user anonymous
Obtained examples/declarative_from_yaml_file/Jenkinsfile from git https://github.com/abayer/kubernetes-plugin.git
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] readTrusted
ERROR: Could not do lightweight checkout, falling back to heavyweight
java.io.FileNotFoundException
	at jenkins.plugins.git.GitSCMFile$3.invoke(GitSCMFile.java:167)
	at jenkins.plugins.git.GitSCMFile$3.invoke(GitSCMFile.java:159)
	at jenkins.plugins.git.GitSCMFileSystem$3.invoke(GitSCMFileSystem.java:193)
	at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:72)
	at jenkins.plugins.git.GitSCMFileSystem.invoke(GitSCMFileSystem.java:189)
	at jenkins.plugins.git.GitSCMFile.content(GitSCMFile.java:159)
	at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338)
	at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:103)
	at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82)
	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
	at hudson.security.ACL.impersonate(ACL.java:290)
	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
	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)
[Pipeline] End of Pipeline
ERROR: ‘readTrusted’ is only available when using “Multibranch Pipeline” or “Pipeline script from SCM”
Finished: FAILURE

@abayer
Copy link
Member Author

abayer commented Jun 29, 2018

@carlossg - works in my test env - looks like https://jenkins.gke.csanchez.org/blue/organizations/jenkins/jenkinsci%2Fkubernetes-plugin/detail/PR-355/4/pipeline#step-30-log-251 may be the relevant bit? git not installed on the "master" image?

@abayer
Copy link
Member Author

abayer commented Jun 29, 2018

Well, slightly more accurately, the test still fails for me due to the agent not being able to talk to the Jenkins master, but I'm fairly sure that's just a botched setup of mine, and the readTrusted and provisioning on Kubernetes parts work perfectly.

…n't access the localhost disk for the git repo
@abayer
Copy link
Member Author

abayer commented Jun 29, 2018

Got past that, hit another gotcha in that the auto-checkout of the SCM in the actual Jenkinsfile didn't work because the repo's URL is...a path on the host we're running Maven on, which the container obviously can't get at it. Easy fix - just added skipDefaultCheckout(true) to options and now it passes.

@carlossg
Copy link
Contributor

ok, now the example runs with hpi:run

@Vlatombe Vlatombe changed the title [FIXED JENKINS-52559] Add yamlFile option for Declarative agent [FIXED JENKINS-52259] Add yamlFile option for Declarative agent Jul 2, 2018
@carlossg carlossg merged commit 9806653 into jenkinsci:master Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants