require 'jenkins_api_client' module JenkinsWorkflow # Handles finishing the installation of a new Jenkins server. class Setup attr_accessor :url def initialize(url: nil) @url = url end def list_plugins client.plugin.list_installed end def list_available_plugins client.plugin.list_available end def setup_plugins client.plugin.install('p4') client.plugin.install('workflow-aggregator') puts "Go to the update center at #{url}/updateCenter/ and restart jenkins after everything's installed" end def list_slaves client.node.list end def add_omnibus_build(build_host, os) client.node.create_dumb_slave( name: create_name('omnibus_build', build_host), description: "Omnibus Build Machine at #{build_host}", executors: 1, remote_fs: '/home/vagrant/jenkins', mode: 'exclusive', labels: "build-omnibus-#{os}", slave_user: 'vagrant', slave_host: build_host, private_key_file: '/home/vagrant/.ssh/vagrant_key' ) end def add_test(test_host, os) client.node.create_dumb_slave( name: create_name('package_test', test_host), description: "Package Test Machine at #{test_host}", executors: 1, remote_fs: '/home/vagrant/jenkins', mode: 'exclusive', labels: "test-omnibus-#{os}", slave_user: 'vagrant', slave_host: test_host, private_key_file: '/home/vagrant/.ssh/vagrant_key' ) end def create_name(prefix, host) "#{prefix}_#{host.gsub(/\./, '')}" end private def client JenkinsApi::Client.new(server_url: url, log_level: Logger::WARN) end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15741 | ptomiak | Branch HWS for my use. | ||
//guest/perforce_software/helix-web-services/main/infrastructure/jenkins_workflow/lib/jenkins_workflow/setup.rb | |||||
#3 | 15661 | tjuricek |
Add some basic email notification. Note: the 'P4' Jenkins plugin doesn't seem to alter the workflow environment. This means we don't really get access to the changelist we've synced. I'm investigating, this would be nice to have. |
||
#2 | 15634 | tjuricek |
Add rules for setting up and running Centos 6. There's a strange problem coming back around with package tests again, not everything's 100% |
||
#1 | 15623 | tjuricek |
Add infrastructure project. This project should allow any team to setup a CD environment locally using VMWare products. A 'build' workflow will run tests, generate installers, etc, on a Jenkins instance configured with necessary plugins. A later 'release' workflow will initially push successful runs into the 'build/' directory of the branch in the workshop. (A 'production release' will use that data and push it into internal infrastructure for package signing and hosting.) Documentation will be written. This is a large set of files, so I wanted to submit them where my connection to the workshop server is faster. |