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 +4 -4
- data/lib/miriamtech/gocd/artifacts.rb +10 -0
- data/lib/miriamtech/gocd/docker.rb +1 -3
- data/lib/miriamtech/gocd/paths.rb +4 -0
- data/lib/miriamtech/gocd/tasks.rb +21 -7
- data/lib/miriamtech/gocd/version.rb +1 -1
- data/miriamtech-gocd.gemspec +2 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1d722ba99c05bc4ee1fa260006ece0b86f16293ae46962e65032b38c4af3e5f
|
4
|
+
data.tar.gz: 3aceb0eac5244fa478caaa7893677e33bc8368c72f690127034c14b5a82ccb5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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'] ||
|
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
|
@@ -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
|
-
|
14
|
-
|
15
|
-
docker_compose "stop"
|
14
|
+
task :environment do
|
15
|
+
ENV['BUILD_TAG'] = build_tag
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
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
|
data/miriamtech-gocd.gemspec
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2020-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
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: '
|
26
|
+
version: '10.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|