Module: HybridPlatformsConductor::Bitbucket
- Includes:
- Credentials
- Included in:
- HpcPlugins::Test::BitbucketConf, HpcPlugins::Test::JenkinsCiConf, HpcPlugins::Test::JenkinsCiMastersOk
- Defined in:
- lib/hybrid_platforms_conductor/bitbucket.rb
Overview
Mixin used to access Bitbucket API
Defined Under Namespace
Classes: BitbucketApi
Instance Method Summary collapse
-
#for_each_bitbucket_repo ⇒ Object
Iterate over each Bitbucket repository.
-
#with_bitbucket(bitbucket_url) ⇒ Object
Provide a Bitbucket connector, and make sure the password is being cleaned when exiting.
Methods included from Credentials
Instance Method Details
#for_each_bitbucket_repo ⇒ Object
Iterate over each Bitbucket repository
- Parameters
-
Proc: Code called for each Bitbucket repository:
- Parameters
-
bitbucket (Bitbucket): The Bitbucket instance used to query the API for this repository
-
repo_info (Hash<Symbol, Object>): The repository info:
-
name (String): Repository name.
-
project (String): Project name.
-
url (String): Project Git URL.
-
jenkins_ci_url (String or nil): Corresponding Jenkins CI URL, or nil if none.
-
checks (Hash<Symbol, Object>): Checks to be performed on this repository:
-
branch_permissions (Array< Hash<Symbol, Object> >): List of branch permissions to check [optional]
-
type (String): Type of branch permissions to check. Examples of values are ‘fast-forward-only’, ‘no-deletes’, ‘pull-request-only’.
-
branch (String): Branch on which those permissions apply.
-
exempted_users (Array<String>): List of exempted users for this permission [default: []]
-
exempted_groups (Array<String>): List of exempted groups for this permission [default: []]
-
exempted_keys (Array<String>): List of exempted access keys for this permission [default: []]
-
-
pr_settings (Hash<Symbol, Object>): PR specific settings to check [optional]
-
required_approvers (Integer): Number of required approvers [optional]
-
required_builds (Integer): Number of required successful builds [optional]
-
default_merge_strategy (String): Name of the default merge strategy. Example: ‘rebase-no-ff’ [optional]
-
mandatory_default_reviewers (Array<String>): List of mandatory reviewers to check [default: []]
-
-
-
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/hybrid_platforms_conductor/bitbucket.rb', line 50 def for_each_bitbucket_repo @config.known_bitbucket_repos.each do |bitbucket_repo_info| with_bitbucket(bitbucket_repo_info[:url]) do |bitbucket| (bitbucket_repo_info[:repos] == :all ? bitbucket.repos(bitbucket_repo_info[:project])['values'].map { |repo_info| repo_info['slug'] } : bitbucket_repo_info[:repos]).each do |name| yield bitbucket, { name: name, project: bitbucket_repo_info[:project], url: "#{bitbucket_repo_info[:url]}/scm/#{bitbucket_repo_info[:project].downcase}/#{name}.git", jenkins_ci_url: bitbucket_repo_info[:jenkins_ci_url].nil? ? nil : "#{bitbucket_repo_info[:jenkins_ci_url]}/job/#{name}", checks: bitbucket_repo_info[:checks] } end end end end |
#with_bitbucket(bitbucket_url) ⇒ Object
Provide a Bitbucket connector, and make sure the password is being cleaned when exiting.
- Parameters
-
bitbucket_url (String): The Bitbucket URL
-
Proc: Code called with the Bitbucket instance.
-
bitbucket (BitbucketApi): The Bitbucket instance to use.
-
21 22 23 24 25 |
# File 'lib/hybrid_platforms_conductor/bitbucket.rb', line 21 def with_bitbucket(bitbucket_url) with_credentials_for(:bitbucket, resource: bitbucket_url) do |bitbucket_user, bitbucket_password| yield BitbucketApi.new(bitbucket_url, bitbucket_user, bitbucket_password, logger: @logger, logger_stderr: @logger_stderr) end end |