Skip to content

Commit

Permalink
Merge branch 'master' into sysconfig-variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rnt committed Jan 3, 2019
2 parents adb5ed6 + 85efe24 commit 1da4595
Show file tree
Hide file tree
Showing 153 changed files with 1,929 additions and 1,425 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ services: docker

env:
matrix:
- INSTANCE=smoke-package-stable-centos-6
# - INSTANCE=smoke-package-stable-centos-6 # terribly slow; takes more than 45 minutes
- INSTANCE=smoke-package-stable-centos-7
- INSTANCE=smoke-package-stable-debian-9
- INSTANCE=smoke-package-stable-ubuntu-1604
- INSTANCE=smoke-war-stable-centos-6
# - INSTANCE=smoke-war-stable-centos-6 # terribly slow; takes more than 45 minutes
- INSTANCE=smoke-war-stable-centos-7
- INSTANCE=smoke-war-stable-debian-8
- INSTANCE=smoke-war-stable-debian-9
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This file is used to list changes made in each version of the jenkins cookbook.

## 6.2.1 (2018-11-14)

- @josh-barker entirely rewrote our test suites. Suites have been consolidated, everything now passes, and all validation is performed with all new InSpec tests. Thanks Josh for this massive improvement.
- Fix bug when remote plugin is not found in plugin universe
- Fix broken delete action for jnlp slave
- Fix cloning resources attributes for/var/lib/jenkins
- Set httpKeepAliveTimeout to 5 minutes so that connections are not closed too early
- Increase slave launch timeout to 2 minutes for slow systems
- Add documentation about slave failure due to slow performance
- Mark windows template sensitive if setting password, remove default '.' for windows users domain

## 6.2.0 (2018-07-30)

- Code improvement for custom plugin update centre
Expand Down
4 changes: 2 additions & 2 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ transport:

provisioner:
name: dokken
deprecations_as_errors: false
deprecations_as_errors: true

verifier:
name: inspec
Expand Down Expand Up @@ -64,5 +64,5 @@ platforms:

- name: opensuse-leap
driver:
image: dokken/opensuse-leap
image: dokken/opensuse-leap-42
pid_one_command: /bin/systemd
106 changes: 24 additions & 82 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ provisioner:
host: localhost
install_method: war
mirror: https://updates.jenkins.io
runit:
sv_timeout: 30
# This is to help slaves to connect to the master
# Sometimes with slow performance the connection is dropped/cut too early
# 30 seconds was too low, so I bumped it to 5 minutes
# https://issues.jenkins-ci.org/browse/JENKINS-38623
jenkins_args: '--httpKeepAliveTimeout=300000'

platforms:
- name: amazonlinux
Expand All @@ -38,19 +45,22 @@ platforms:
driver:
box: chef/windows-server-2016-standard # private box

verifier:
name: inspec

suites:
#
# Smoke suite
#
- name: smoke_package_stable
run_list: jenkins_server_wrapper::default
run_list: jenkins_smoke::default
excludes:
- ubuntu-14.04
- windows-2012r2
- windows-2016

- name: smoke_package_current
run_list: jenkins_server_wrapper::default
run_list: jenkins_smoke::default
attributes:
jenkins:
master:
Expand All @@ -59,15 +69,17 @@ suites:
- ubuntu-14.04
- windows-2012r2
- windows-2016

- name: smoke_war_stable
run_list: jenkins_server_wrapper::default
run_list: jenkins_smoke::default
attributes:
jenkins:
master:
install_method: war
source: https://updates.jenkins.io/stable/latest/jenkins.war

- name: smoke_war_latest
run_list: jenkins_server_wrapper::default
run_list: jenkins_smoke::default
attributes:
jenkins:
master:
Expand All @@ -77,91 +89,21 @@ suites:
#
# Authentication suites
#
- name: authentication_private_key
- name: authentication_private_key # Tested in smoke suite
run_list: jenkins_authentication::private_key

- name: authentication_username_password
run_list: jenkins_authentication::username_password

#
# Command suites
#
- name: jenkins_command_execute
run_list: jenkins_command::execute

#
# Credentials suites
#
- name: jenkins_credentials_create
run_list: jenkins_credentials::create
- name: jenkins_credentials_delete
run_list: jenkins_credentials::delete

#
# Job suites
#
- name: jenkins_job_create
run_list:
- jenkins_job::create
- jenkins_job::create_folder
- name: jenkins_job_delete
run_list: jenkins_job::delete
- name: jenkins_job_disable
run_list: jenkins_job::disable
- name: jenkins_job_enable
run_list: jenkins_job::enable
- name: jenkins_job_build
run_list: jenkins_job::build

#
# Script suites
#
- name: jenkins_script
run_list: jenkins_script::execute

#
# Plugin suites
#
- name: jenkins_plugin_disable
run_list: jenkins_plugin::disable
- name: jenkins_plugin_enable
run_list: jenkins_plugin::enable
- name: jenkins_plugin_install
run_list: jenkins_plugin::install
- name: jenkins_plugin_uninstall
run_list: jenkins_plugin::uninstall
excludes:
- windows-2012r2
- windows-2016

#
# Proxy suites
# Cannot be tested together
# As the proxy settings are global
#
- name: jenkins_proxy_config
- name: jenkins_proxy_config # Tested in smoke suite
run_list: jenkins_proxy::config
- name: jenkins_proxy_remove
run_list: jenkins_proxy::remove

#
# Slave suites
#
- name: jenkins_slave_create
run_list:
- jenkins_slave::create_jnlp
- jenkins_slave::create_ssh
- name: jenkins_slave_delete
run_list:
- jenkins_slave::delete_jnlp
- jenkins_slave::delete_ssh
- name: jenkins_slave_connect
run_list: jenkins_slave::connect
- name: jenkins_slave_disconnect
run_list: jenkins_slave::disconnect
- name: jenkins_slave_online
run_list: jenkins_slave::online
- name: jenkins_slave_offline
run_list: jenkins_slave::offline

#
# User suites
#
- name: jenkins_user_create
run_list: jenkins_user::create
- name: jenkins_user_delete
run_list: jenkins_user::delete
18 changes: 8 additions & 10 deletions libraries/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,14 @@ def correct_config?
def validate_config!
Chef::Log.debug "Validate #{new_resource} configuration"

if new_resource.config.nil?
raise("#{new_resource} must specify a configuration file!")
elsif !::File.exist?(new_resource.config)
raise("#{new_resource} config `#{new_resource.config}` does not exist!")
else
begin
REXML::Document.new(::File.read(new_resource.config))
rescue REXML::ParseException
raise("#{new_resource} config `#{new_resource.config}` is not valid XML!")
end
raise("#{new_resource} must specify a configuration file!") if new_resource.config.nil?

raise("#{new_resource} config `#{new_resource.config}` does not exist!") unless ::File.exist?(new_resource.config)

begin
REXML::Document.new(::File.read(new_resource.config))
rescue REXML::ParseException
raise("#{new_resource} config `#{new_resource.config}` is not valid XML!")
end
end

Expand Down
3 changes: 3 additions & 0 deletions libraries/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ def desired_version(name = nil, version = nil)

if version.to_sym == :latest
remote_plugin_data = plugin_universe[name]

return :latest unless remote_plugin_data

plugin_version(remote_plugin_data['version'])
else
plugin_version(version)
Expand Down
36 changes: 20 additions & 16 deletions libraries/slave_jnlp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,7 @@ def load_current_resource

include_recipe 'runit'

declare_resource(:runit_service, new_resource.service_name).tap do |r|
# We need to use .tap() to access methods in the provider's scope.
r.cookbook('jenkins')
r.run_template_name('jenkins-slave')
r.log_template_name('jenkins-slave')
r.options(
service_name: new_resource.service_name,
jvm_options: new_resource.jvm_options,
user: new_resource.user,
remote_fs: new_resource.remote_fs,
java_bin: java,
slave_jar: slave_jar,
jnlp_url: jnlp_url,
jnlp_secret: jnlp_secret
)
end
service_resource
end

action :delete do
Expand Down Expand Up @@ -167,6 +152,25 @@ def slave_jar_url
@slave_jar_url ||= uri_join(endpoint, 'jnlpJars', 'slave.jar')
end

def service_resource
declare_resource(:runit_service, new_resource.service_name).tap do |r|
# We need to use .tap() to access methods in the provider's scope.
r.cookbook('jenkins')
r.run_template_name('jenkins-slave')
r.log_template_name('jenkins-slave')
r.options(
service_name: new_resource.service_name,
jvm_options: new_resource.jvm_options,
user: new_resource.user,
remote_fs: new_resource.remote_fs,
java_bin: java,
slave_jar: slave_jar,
jnlp_url: jnlp_url,
jnlp_secret: jnlp_secret
)
end
end

#
# The path to the +slave.jar+ on disk (which may or may not exist).
#
Expand Down
5 changes: 2 additions & 3 deletions libraries/slave_windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def slave_xml_resource
@slave_xml_resource = Chef::Resource::Template.new(slave_xml, run_context)
@slave_xml_resource.cookbook('jenkins')
@slave_xml_resource.source('jenkins-slave.xml.erb')
@slave_xml_resource.sensitive = true if new_resource.password
@slave_xml_resource.variables(
new_resource: new_resource,
endpoint: endpoint,
Expand Down Expand Up @@ -263,16 +264,14 @@ def service_resource
end

#
# Windows domain for the user or `.` if a domain is not set.
# Windows domain for the user or nil if there is no domain.
#
# @return [String]
#
def user_domain
@user_domain ||= begin
if (parts = new_resource.user.match(/(?<domain>.*)\\(?<account>.*)/))
parts[:domain]
else
'.'
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'Apache-2.0'
description 'Installs and configures Jenkins CI master & slaves'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '6.3.0'
version '6.4.0'

recipe 'jenkins::master', 'Installs a Jenkins master'

Expand Down
2 changes: 0 additions & 2 deletions test/fixtures/cookbooks/jenkins_command/recipes/execute.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include_recipe 'jenkins_server_wrapper::default'

# Execute some simple commands
jenkins_command 'clear-queue'
jenkins_command 'help'
Expand Down
Loading

0 comments on commit 1da4595

Please sign in to comment.