Class: Bozo::Hooks::OctopusCreateRelease

Inherits:
Object
  • Object
show all
Defined in:
lib/bozo/hooks/octopus_create_release.rb

Overview

Hook to create a release in Octopus.

Instance Method Summary collapse

Constructor Details

#initializeOctopusCreateRelease

Returns a new instance of OctopusCreateRelease.



6
7
8
9
# File 'lib/bozo/hooks/octopus_create_release.rb', line 6

def initialize
  @deploy_to = nil
  @display_progress = false
end

Instance Method Details

#api_key(value) ⇒ Object

The api key to authorise to Octopus with.



26
27
28
# File 'lib/bozo/hooks/octopus_create_release.rb', line 26

def api_key(value)
  @octopus_api_key = value
end

#deploy_to(value) ⇒ Object

Specify the environment in Octopus to deploy to.



31
32
33
# File 'lib/bozo/hooks/octopus_create_release.rb', line 31

def deploy_to(value)
  @deploy_to = value
end

#display_progress(value) ⇒ Object

Write the deployment log from Octopus. If false then the hook does not wait for the release to complete.



37
38
39
# File 'lib/bozo/hooks/octopus_create_release.rb', line 37

def display_progress(value)
  @display_progress = value
end

#post_publishObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/bozo/hooks/octopus_create_release.rb', line 41

def post_publish
  return unless build_server?
  log_info "Creating release in Octopus for #{env['BUILD_VERSION_FULL']}"

  args = []
  args << File.expand_path(File.join('build', 'tools', 'octopustools', 'Octo.exe'))
  args << 'create-release'
  args << "--project \"#{@octopus_project}\""
  args << "--version #{env['BUILD_VERSION_FULL']}"
  args << "--packageversion #{env['BUILD_VERSION_FULL']}"
  args << "--server #{@octopus_server}"
  args << ['--apiKey', Bozo::SensitiveValue.new(@octopus_api_key)]
  args << "--releaseNotes \"[Build #{env['BUILD_VERSION_FULL']}](#{env['BUILD_URL']})\""

  if @display_progress
    args << '--progress'
  end

  if @deploy_to
    args << "--deployto=#{@deploy_to}"
  end

  execute_command :octo, args
end

#project(value) ⇒ Object

Specify the name of the Octopus Deploy project to create a release for.



16
17
18
# File 'lib/bozo/hooks/octopus_create_release.rb', line 16

def project(value)
  @octopus_project = value
end

#required_toolsObject



11
12
13
# File 'lib/bozo/hooks/octopus_create_release.rb', line 11

def required_tools
  :octopus_tools
end

#server(value) ⇒ Object

The server address of Octopus.



21
22
23
# File 'lib/bozo/hooks/octopus_create_release.rb', line 21

def server(value)
  @octopus_server = value
end