Class: Hako::Scripts::GithubStatusTag

Inherits:
Script
  • Object
show all
Defined in:
lib/hako/scripts/github_status_tag.rb

Defined Under Namespace

Classes: NoSuccessfulBuildError

Constant Summary collapse

TARGET_TAG =
'github'
GITHUB_APP_MEDIA =
'application/vnd.github.machine-man-preview+json'
GITHUB_CHECKS_MEDIA =
'application/vnd.github.antiope-preview+json'

Instance Method Summary collapse

Instance Method Details

#configure(options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hako/scripts/github_status_tag.rb', line 14

def configure(options)
  super
  @repo = options.fetch('repo')
  @ref = options.fetch('ref', 'master')
  @checks = options.fetch('checks', [])
  @statuses = options.fetch('statuses ', [])
  @client_options = options.fetch('client', {})

  if @checks.empty? && @statuses.empty?
    raise ArgumentError, "at least 1 check or 1 status must be set to github_status_tag script"
  end
end

#deploy_starting(containers) ⇒ Object Also known as: oneshot_starting



27
28
29
30
31
32
# File 'lib/hako/scripts/github_status_tag.rb', line 27

def deploy_starting(containers)
  app = containers.fetch('app')
  if app.definition['tag'] == TARGET_TAG
    rewrite_tag(app)
  end
end