Class: TerraspaceCiBitbucket::Vars
- Inherits:
-
Object
- Object
- TerraspaceCiBitbucket::Vars
- Defined in:
- lib/terraspace_ci_bitbucket/vars.rb
Instance Method Summary collapse
- #branch_name ⇒ Object
- #branch_url ⇒ Object
- #build_id ⇒ Object
- #build_type ⇒ Object
- #build_url ⇒ Object
- #commit_url ⇒ Object
-
#data ⇒ Object
Hash of properties to store.
- #full_repo ⇒ Object
- #host ⇒ Object
- #pr_number ⇒ Object
- #pr_url ⇒ Object
- #repo_url ⇒ Object
- #sha ⇒ Object
Instance Method Details
#branch_name ⇒ Object
53 54 55 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 53 def branch_name ENV['BITBUCKET_BRANCH'] end |
#branch_url ⇒ Object
33 34 35 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 33 def branch_url "#{host}/#{full_repo}/branch/#{branch_name}" end |
#build_id ⇒ Object
65 66 67 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 65 def build_id ENV['BITBUCKET_BUILD_NUMBER'] end |
#build_type ⇒ Object
69 70 71 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 69 def build_type 'pull_request' if ENV['BITBUCKET_PR_ID'] end |
#build_url ⇒ Object
41 42 43 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 41 def build_url "#{repo_url}/addon/pipelines/home#!/results/#{build_id}" end |
#commit_url ⇒ Object
29 30 31 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 29 def commit_url "#{host}/#{full_repo}/commits/#{sha}" end |
#data ⇒ Object
Hash of properties to store
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 4 def data { build_system: "bitbucket", host: host, full_repo: full_repo, branch_name: branch_name, # urls pr_url: pr_url, build_url: build_url, branch_url: branch_url, # additional properties build_type: build_type, # required IE: pull_request or push pr_number: pr_number, # set when build_type=pull_request sha: sha, # additional properties # commit_message: commit_message, build_id: build_id, build_number: ENV['REPLACE_ME'], } end |
#full_repo ⇒ Object
61 62 63 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 61 def full_repo ENV['BITBUCKET_REPO_FULL_NAME'] end |
#host ⇒ Object
25 26 27 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 25 def host ENV['BITBUCKET_HOST'] || 'https://bitbucket.org' end |
#pr_number ⇒ Object
45 46 47 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 45 def pr_number ENV['BITBUCKET_PR_ID'] end |
#pr_url ⇒ Object
37 38 39 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 37 def pr_url "#{host}/#{full_repo}/pull-requests/#{pr_number}" if pr_number end |
#repo_url ⇒ Object
49 50 51 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 49 def repo_url ENV['BITBUCKET_GIT_HTTP_ORIGIN'] end |
#sha ⇒ Object
57 58 59 |
# File 'lib/terraspace_ci_bitbucket/vars.rb', line 57 def sha ENV['BITBUCKET_COMMIT'] end |