require 'thor' require 'jenkins_workflow/setup' require 'jenkins_workflow/build' require 'jenkins_workflow/publisher' module JenkinsWorkflow class Nodes < Thor class_option :server, aliases: ['-s'], desc: 'Jenkins Server URL' desc 'list', 'Return all Jenkins slaves in the system' def list slaves = setup.list_slaves puts slaves.sort end desc 'addbuild <host> <os>', 'Add omnibus build node' def addbuild(host, os) setup.add_omnibus_build(host, os) end desc 'addtest <host> <os>', 'Add package test node' def addtest(host, os) setup.add_test(host, os) end private def setup Setup.new(url: options['server']) end end class Plugins < Thor class_option :server, aliases: ['-s'], desc: 'Jenkins Server URL' desc 'list', 'List plugins on server' def list plugins = setup.list_plugins plugins.keys.sort.each do |name| puts "#{name} (#{plugins[name]})" end end desc 'available', 'List available plugins' def available plugins = setup.list_available_plugins plugins.keys.sort.each do |name| puts "#{name} (#{plugins[name]})" end end desc 'init', 'Initialize required plugins' def init setup.setup_plugins end private def setup Setup.new(url: options['server']) end end class Jobs < Thor class_option :server, aliases: ['-s'], desc: 'Jenkins Server URL' desc 'create JOB_NAME DEPOT_PATH CREDENTIAL BRANCH MAILTO TEST_UBUNTU12 TEST_UBUNTU14 TEST_CENTOS6', 'Create new workflow job for HWS' def create(job_name, depot_path, credential, branch, mailto, test_ubuntu12, test_ubuntu14, test_centos6) build.create(job_name: job_name, depot_path: depot_path, credential: credential, branch: branch, mailto: mailto, test_ubuntu12: test_ubuntu12, test_ubuntu14: test_ubuntu14, test_centos6: test_centos6) end private def build Build.new(url: options['server']) end end class Publish < Thor class_option :server, aliases: ['-s'], desc: 'Jenkins Server URL' desc 'job JOB_URL WORKSPACE', 'Publish Jenkins job results' def job(job_url, workspace) publisher.archive_results(job_url, workspace) end private def publisher Publisher.new(url: options['server']) end end # The primary class mostly refers to subcommands, and a couple of generic # options. class CLI < Thor desc 'nodes SUBCOMMAND', 'manage Jenkins nodes in the cluster' subcommand 'nodes', Nodes desc 'plugins SUBCOMMAND', 'Manage Jenkins plugins on the master' subcommand 'plugins', Plugins desc 'jobs SUBCOMMAND', 'Manage Jenkins jobs on the master' subcommand 'jobs', Jobs desc 'publish SUBCOMMAND', 'Publish Jenkins jobs to a local workspace' subcommand 'publish', Publish 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/cli.rb | |||||
#4 | 15675 | tjuricek |
Add basic 'publish' step for Jenkins jobs. This will archive files in a local workspace. The exact automated workflow hasn't been ironed out yet. |
||
#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. |