Class: HybridPlatformsConductor::HpcPlugins::Test::JenkinsCiConf
- Defined in:
- lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb
Overview
Check that all repositories have a correct Jenkins CI configuration.
Constant Summary
Constants included from LoggerHelpers
LoggerHelpers::LEVELS_MODIFIERS, LoggerHelpers::LEVELS_TO_STDERR
Instance Attribute Summary
Attributes inherited from Test
#errors, #expected_failure, #name, #node, #platform
Instance Method Summary collapse
-
#test ⇒ Object
Check my_test_plugin.rb.sample documentation for signature details.
Methods inherited from Test
#assert_equal, #assert_match, #error, #executed, #executed?, #initialize, only_on_nodes, only_on_platforms, #to_s
Methods inherited from Plugin
extend_config_dsl_with, #initialize, valid?
Methods included from LoggerHelpers
#err, #init_loggers, #log_component=, #log_debug?, #log_level=, #out, #section, #set_loggers_format, #stderr_device, #stderr_device=, #stderr_displayed?, #stdout_device, #stdout_device=, #stdout_displayed?, #stdouts_to_s, #with_progress_bar
Constructor Details
This class inherits a constructor from HybridPlatformsConductor::Test
Instance Method Details
#test ⇒ Object
Check my_test_plugin.rb.sample documentation for signature details.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb', line 17 def test @config.for_each_bitbucket_repo do |bitbucket, repo_info| if repo_info[:jenkins_ci_url].nil? error "Repository #{repo_info[:name]} does not have any Jenkins CI URL configured." else Credentials.with_credentials_for(:jenkins_ci, @logger, @logger_stderr, url: repo_info[:jenkins_ci_url]) do |jenkins_user, jenkins_password| # Get its config begin doc = Nokogiri::XML(open("#{repo_info[:jenkins_ci_url]}/config.xml", http_basic_authentication: [jenkins_user, jenkins_password]).read) # Check that this job builds the correct Bitbucket repository assert_equal( doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/serverUrl').text, bitbucket.bitbucket_url, "Job #{repo_info[:jenkins_ci_url]} does not build repository from Bitbucket" ) assert_equal( doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/repoOwner').text.downcase, repo_info[:project].downcase, "Job #{repo_info[:jenkins_ci_url]} does not build repository from project #{repo_info[:project]}" ) assert_equal( doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/repository').text, repo_info[:name], "Job #{repo_info[:jenkins_ci_url]} does not build repository named #{repo_info[:name]}" ) rescue error "Error while checking Jenkins CI job for #{repo_info[:project]}/#{repo_info[:name]} from URL #{repo_info[:jenkins_ci_url]}: #{$!}" end end end end end |