-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
How to use SSH protocol mode in cookbook? #613
Comments
Here's my solution for flipping SSHd on by defualt in my owi_jenkins cookbook. Got the idea from https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Hook+Script and the Jenkins Docker container Dockerfile and how they're doing automated setup. This still does not fix plugin installation, btw. owi_jenkins::master :
sshd_configure.groovy.erb :
default.rb attributes:
|
There is also a file created that you could edit and restart Jenkins to take effect it's located at |
Need help : server # java -jar /opt/tomcat/webapps/ROOT/WEB-INF/jenkins-cli.jar -s http://localhost:8181/ -ssh -user update -i /home/update/.ssh/id_rsa who-am-i Failure via chef cookbook recipe : I am running it as a bash command resource in my recipe . [2018-02-16T11:27:39+01:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: bash[install jenkins plugins] (sap-bs-jenkins::bs_jenkins line 104) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '255' Jenkins ssh port is set to random , and X-SSH-Endpoint is indeed set server # curl -I http://localhost:8181 |
@jj2007 you may need to run |
@isuftin I think if you use the snippet(s) from this answer in your |
@espoelstra Thanks I will give it a shot! |
So according to this post and what I've gathered from the README here, you should just be able to add the snippets for the |
Jenkins, by default, starts with SSH mode disabled. It's unclear what the workflow should be in order to set ssh as the default protocol in
node['executor']['protocol']
. If the cookbook initially attempts to converge using the ssh protocol, any CLI command attempted will fail because Jenkins is not accepting SSH connections. A user would manually need to go into the running Jenkins server and turn SSHd on. This breaks a fully automated CM workflow.With current Jenkins releases, the remoting protocol is deprecated and should not be used.
This leaves the user with only http as the protocol that may be used.
I can't find any documentation for Jenkins that describes how Jenkins may be started with SSHd running.
Cookbook version
5.0.1
Chef-client version
13.0.118
Platform Details
CentOS 6.8 VM in VirtualBox. Running on MacOS 10.10.x
Scenario:
Set protocol to SSH for initial creation of the Jenkins server, attempt to perform any CLI action via downstream actions like adding a user or installing a plugin once server is running via jenkins::master
Steps to Reproduce:
Set execute protocol to ssh, run jenkins::master and then attempt to install a plugin via the plugin installation jenkins_plugin action.
Expected Result:
CLI command runs as expected
Actual Result:
The text was updated successfully, but these errors were encountered: