Class: Jets::Git::Codebuild

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/git/codebuild.rb

Instance Method Summary collapse

Instance Method Details

#full_repoObject

ORG/REPO



34
35
36
37
# File 'lib/jets/git/codebuild.rb', line 34

def full_repo
  uri = URI(repo_url)
  uri.path.sub(/^\//,'')
end

#git_branchObject



16
17
18
# File 'lib/jets/git/codebuild.rb', line 16

def git_branch
  ENV['CODEBUILD_SOURCE_VERSION']
end

#git_shaObject



20
21
22
# File 'lib/jets/git/codebuild.rb', line 20

def git_sha
  ENV['CODEBUILD_RESOLVED_SOURCE_VERSION']
end

#git_urlObject



24
25
26
# File 'lib/jets/git/codebuild.rb', line 24

def git_url
  "#{host}/#{full_repo}"
end

#hostObject



28
29
30
31
# File 'lib/jets/git/codebuild.rb', line 28

def host
  uri = URI(ENV['CODEBUILD_SOURCE_REPO_URL']) # https://github.com/ORG/REPO
  "#{uri.scheme}://#{uri.host}"
end

#paramsObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/jets/git/codebuild.rb', line 3

def params
  params = {
    git_system: 'codebuild',
    git_branch: git_branch,
    git_sha: git_sha,
    git_dirty: false,
    # git_message: nil,
    # git_version: nil,
  }
  params[:git_url] = git_url if git_url
  params
end

#repo_urlObject



40
41
42
43
# File 'lib/jets/git/codebuild.rb', line 40

def repo_url
  # https://github.com/ORG/REPO.git
  ENV['CODEBUILD_SOURCE_REPO_URL'].sub('.git','')
end