miriamtech-gocd 0.2.2 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fd6f7f97ab269c84fc2ecda57052f06ce2ae4e69a57edac74ca39d4915b9599
4
- data.tar.gz: b4acb39072790bc21974ca92108f9bb61b9eb3ac6794ae3d51557c29bcb95db3
3
+ metadata.gz: d1d722ba99c05bc4ee1fa260006ece0b86f16293ae46962e65032b38c4af3e5f
4
+ data.tar.gz: 3aceb0eac5244fa478caaa7893677e33bc8368c72f690127034c14b5a82ccb5d
5
5
  SHA512:
6
- metadata.gz: 3e46888fa28d02a83e4006cc41bed2acd1523c5cdcdd45f5e58ede73d2fcbf2c348bfe584ec3d59ee6a0d717a8673592f6fae4841f7e24df6efedb34387ffd24
7
- data.tar.gz: b19f71bfc439c60bc5d270bde00e40cf11bb6e9201b68a3130ac3ba0e45e9aade255e0c1ee618006f6f1b9ad885ef5845eb5ab157afce0e8808655fb907836e2
6
+ metadata.gz: df45c585d2e5629dfd6c6d6c0a0aa60fc89f3a7be0d358fd8e1cbdb20a28615824c46b831aec4ac9a2566b75f20b1c3f2ef84541455b02ba4255f9a361880e2f
7
+ data.tar.gz: 194f1632e39f2b5a463b48aad89f1150c7dce5b534dbf0152b2e6ed8c02d7a19e572056cf514a6d00474c1185a2a2ab6126542c497927dc5c09b4bcb01e67cf2
@@ -1,6 +1,16 @@
1
1
  module MiriamTech
2
2
  module GoCD
3
3
  module DSL
4
+ def capture_artifacts(prefix = project_name, workdir:, path:, &block)
5
+ with_artifacts_volume(prefix) do |volume_name|
6
+ begin
7
+ yield "-v #{volume_name}:#{workdir}/#{path}"
8
+ ensure
9
+ copy_artifacts_from_volume(volume_name, local_path: path)
10
+ end
11
+ end
12
+ end
13
+
4
14
  def with_artifacts_volume(prefix = project_name, &block)
5
15
  artifacts_volume = sanitized_volume_name("#{prefix}#{build_tag}")
6
16
  docker "volume create #{artifacts_volume}"
@@ -2,7 +2,7 @@ module MiriamTech
2
2
  module GoCD
3
3
  module DSL
4
4
  def project_name(env = ENV)
5
- (env['GO_PIPELINE_NAME'] || File.basename(File.expand_path('.'))).downcase
5
+ (env['GO_PIPELINE_NAME'] || root_path.basename.to_s).downcase
6
6
  end
7
7
 
8
8
  def build_tag(env = ENV)
@@ -14,7 +14,6 @@ module MiriamTech
14
14
  end
15
15
 
16
16
  def docker_compose(string)
17
- # PIPELINE_NAME = (ENV['GO_PIPELINE_NAME'] || 'ilien').downcase
18
17
  cd root_path do
19
18
  sh "docker-compose -p #{project_name} -f docker-compose.yml #{string}"
20
19
  end
@@ -28,7 +27,6 @@ module MiriamTech
28
27
  else
29
28
  @build_tag = ""
30
29
  end
31
- env['BUILD_TAG'] = @build_tag
32
30
  end
33
31
  end
34
32
  end
@@ -12,6 +12,10 @@ module MiriamTech
12
12
  end until path.root?
13
13
  cwd
14
14
  end
15
+
16
+ def compose_file
17
+ root_path / 'docker-compose.yml'
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -1,4 +1,5 @@
1
1
  require 'pathname'
2
+ require 'rake/clean'
2
3
 
3
4
  module MiriamTech
4
5
  module GoCD
@@ -10,24 +11,33 @@ module MiriamTech
10
11
  task :default => [:test]
11
12
  task :full => [:clobber, :build]
12
13
 
13
- CLEAN.add(root_path + '/test/reports')
14
- task :clean do
15
- docker_compose "stop"
14
+ task :environment do
15
+ ENV['BUILD_TAG'] = build_tag
16
16
  end
17
17
 
18
- task :clobber => :cleanup_old_images do
19
- docker_compose "rm -fv"
18
+ CLEAN.add(root_path + 'test/reports')
19
+ task :clean => [:environment]
20
+ task :clobber => [:environment, :cleanup_old_images]
21
+
22
+ if compose_file.exist?
23
+ task :clean do
24
+ docker_compose "stop"
25
+ end
26
+
27
+ task :clobber do
28
+ docker_compose "rm -fv"
29
+ end
20
30
  end
21
31
 
22
32
  task :cleanup_old_images do
23
33
  cleanup_old_images(image_name, revisions_to_keep)
24
34
  end
25
35
 
26
- task :build do
36
+ task :build => :environment do
27
37
  docker "build --force-rm -t #{image_name}#{build_tag} #{root_path}"
28
38
  end
29
39
 
30
- task :test
40
+ task :test => :environment
31
41
 
32
42
  task :push do
33
43
  push(image_name)
@@ -38,6 +48,10 @@ module MiriamTech
38
48
  pull(image_name)
39
49
  push(image_name, 'deployed')
40
50
  end
51
+
52
+ task :bash do
53
+ docker("run -it --rm #{image_name} bash")
54
+ end
41
55
  end
42
56
  end
43
57
  end
@@ -1,5 +1,5 @@
1
1
  module MiriamTech
2
2
  module GoCD
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.7"
4
4
  end
5
5
  end
@@ -26,8 +26,9 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
+ spec.add_dependency "rake", ">= 10.0"
30
+
29
31
  spec.add_development_dependency "bundler", "~> 2.0"
30
- spec.add_development_dependency "rake", ">= 10.0"
31
32
  spec.add_development_dependency "minitest", "~> 5.0"
32
33
  spec.add_development_dependency 'rspec-expectations'
33
34
  spec.add_development_dependency 'rspec-mocks'
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miriamtech-gocd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Treis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-17 00:00:00.000000000 Z
11
+ date: 2020-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :development
19
+ version: '10.0'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '10.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '2.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement