-
-
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
Jenkins now uses systemd instead of SysV but override.conf is not created #783
Comments
Thanks this also affects the |
Here's a recipe and template in my wrapper cookbook to get around this.... can pass other supoprted env vars too (env vars is a jenkins_env = node['jenkins_configuration_wrapper']['jenkins_env']
jenkins_url = node['jenkins_configuration_wrapper']['jenkins_url']
jenkins_env_vars = node['jenkins_configuration_wrapper']['env_vars']
if jenkins_env == 'DEV'
uri_path = jenkins_url.split('/')[-1]
prefix = "Environment=\"JENKINS_PREFIX=/#{uri_path}\""
else
prefix = ''
end
directory '/etc/systemd/system/jenkins.service.d/' do
owner 'root'
group 'root'
mode '0755'
action :create
end
template '/etc/systemd/system/jenkins.service.d/override.conf' do
source 'jenkins_service_override.erb'
owner 'root'
group 'root'
mode '0644'
variables(prefix: prefix,
env_vars: jenkins_env_vars)
end
service 'jenkins' do
action :stop
end
bash 'reload systemctls' do
code <<-RELOAD
systemctl daemon-reload
RELOAD
end
service 'jenkins' do
action :start
end template [Service]
<%= @prefix %>
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"
<% @env_vars.each do |name, value| %>
<%= "Environment=\"#{name}=#{value}\"" %>
<% end %> |
Here's more complete example ripped off line by line from https://github.com/sous-chefs/jenkins/blob/main/templates/jenkins-config-rhel.erb
It is sad nothing been done to this and other critical issues for almost a year. This cookbook basically is inoperable out of the box with latest Jenkins versions. Looks like everyone, including cookbook maintainers, already moved to Kubernetes? Or GitHub Actions? Or both? |
And of course that didn't worked, here's what did in the end:
Also, to better adhere to the jenkins cookbook from the wrapper, it can be done in this way:
|
👻 Brief Description
As of Jenkins 2.332.1, the Linux installation packages use systemd instead of SysV. The cookbook manages
/etc/sysconfig/jenkins
to handle startup options for SysV, but doesn't create an/etc/systemd/system/jenkins.service.d/override.conf
file to handle startup options for systemd. As a result, default startup options are used; options placed intonode['jenkins']['master']['jvm_options']
don't take effect.🥞 Cookbook version
9.5.0
👩🍳 Chef-Infra Version
Chef Infra Client: 16.8.14
🎩 Platform details
Amazon Linux 2 running in AWS
Steps To Reproduce
Steps to reproduce the behavior:
include_recipe 'jenkins::master'
/etc/systemd/system/jenkins.service.d/override.conf
file and the missing java options from the process (ps -efww|grep java
)🚓 Expected behavior
The cookbook should create an
/etc/systemd/system/jenkins.service.d/override.conf
file to handle startup options for systemd.The text was updated successfully, but these errors were encountered: