gantree 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/gantree/cli.rb +2 -0
- data/lib/gantree/deploy_version.rb +22 -5
- data/lib/gantree/version.rb +1 -1
- data/spec/fixtures/project/Dockerrun.aws.json +13 -0
- data/spec/lib/gantree/deploy_version_spec.rb +40 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7097d09fb40c111aa6e5dd2d8321dfc72352573
|
4
|
+
data.tar.gz: f329a9331b10fddbc1b4992e2df9625a0eeb7642
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6baaee7fc76003a556a8f2c47b30e56fd6c0b70eea6556c2c1ebdb9aca930180b5ca18d730ba36bee9aa747d76ac2cbbcf7d80205d8208e97c505ee183bfdc74
|
7
|
+
data.tar.gz: f4f5f8570cf4ee3f0055a128b595c9ba068d9a79ef50681d0548543b2b92b8bbb3ea3279e646a05f71b11eb7fce3fa4458e1d934b401eb52e7a26739870b7351
|
data/.gitignore
CHANGED
data/lib/gantree/cli.rb
CHANGED
@@ -17,6 +17,7 @@ module Gantree
|
|
17
17
|
option :image_path, :aliases => "-i", :desc => "docker hub image path ex. (bleacher/cms | quay.io/bleacherreport/cms)"
|
18
18
|
option :autodetect_app_role, :desc => "use naming convention to determin role (true|false)", :type => :boolean, :default => true
|
19
19
|
option :eb_bucket, :desc => "bucket to store elastic beanstalk versions"
|
20
|
+
option :auth, :desc => "dockerhub authentation, example: bucket/key"
|
20
21
|
def deploy name
|
21
22
|
opts = merge_defaults(options)
|
22
23
|
Gantree::Base.check_for_updates(opts)
|
@@ -98,6 +99,7 @@ module Gantree
|
|
98
99
|
option :image_path, :aliases => "-i", :desc => "hub image path ex. (bleacher/cms | quay.io/bleacherreport/cms)"
|
99
100
|
option :hush, :desc => "quite puts messages", :default => true
|
100
101
|
option :eb_bucket, :desc => "bucket to store elastic beanstalk versions"
|
102
|
+
option :auth, :desc => "dockerhub authentation, example: bucket/key"
|
101
103
|
def ship server
|
102
104
|
opts = merge_defaults(options)
|
103
105
|
Gantree::Base.check_for_updates(opts)
|
@@ -6,11 +6,13 @@ require_relative 'notification'
|
|
6
6
|
module Gantree
|
7
7
|
class DeployVersion < Deploy
|
8
8
|
|
9
|
+
attr_reader :packaged_version, :dockerrun_file
|
9
10
|
def initialize options, env
|
10
11
|
@options = options
|
11
12
|
@ext = @options[:ext]
|
12
13
|
@ext_role = @options[:ext_role]
|
13
|
-
@
|
14
|
+
@project_root = @options[:project_root]
|
15
|
+
@dockerrun_file = "#{@project_root}Dockerrun.aws.json"
|
14
16
|
@env = env
|
15
17
|
end
|
16
18
|
|
@@ -18,18 +20,32 @@ module Gantree
|
|
18
20
|
@packaged_version = create_version_files
|
19
21
|
end
|
20
22
|
|
23
|
+
def docker
|
24
|
+
@docker ||= JSON.parse(IO.read(@dockerrun_file))
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_auth
|
28
|
+
docker["Authentication"] = {}
|
29
|
+
items = @options[:auth].split("/")
|
30
|
+
bucket = items.shift
|
31
|
+
key = items.join("/")
|
32
|
+
docker["Authentication"]["Bucket"] = bucket
|
33
|
+
docker["Authentication"]["Key"] = key
|
34
|
+
IO.write("/tmp/#{@dockerrun_file}", JSON.pretty_generate(docker))
|
35
|
+
end
|
36
|
+
|
21
37
|
def set_tag_to_deploy
|
22
|
-
docker = JSON.parse(IO.read(@dockerrun_file))
|
23
38
|
image = docker["Image"]["Name"]
|
24
39
|
image.gsub!(/:(.*)$/, ":#{@options[:tag]}")
|
25
40
|
IO.write("/tmp/#{@dockerrun_file}", JSON.pretty_generate(docker))
|
26
41
|
end
|
27
42
|
|
28
43
|
def set_image_path
|
29
|
-
docker = JSON.parse(IO.read(@dockerrun_file))
|
30
44
|
image = docker["Image"]["Name"]
|
31
45
|
image.gsub!(/(.*):/, "#{@options[:image_path]}:")
|
32
|
-
|
46
|
+
path = "/tmp/#{@dockerrun_file}"
|
47
|
+
FileUtils.mkdir_p(File.dirname(path)) unless File.exist?(path)
|
48
|
+
IO.write(path, JSON.pretty_generate(docker))
|
33
49
|
image
|
34
50
|
end
|
35
51
|
|
@@ -37,10 +53,11 @@ module Gantree
|
|
37
53
|
clean_up
|
38
54
|
version = "#{tag}-#{Time.now.strftime("%m-%d-%Y-%H-%M-%S")}"
|
39
55
|
puts "version: #{version}"
|
56
|
+
set_auth if @options[:auth]
|
40
57
|
set_image_path if @options[:image_path]
|
41
58
|
set_tag_to_deploy
|
42
59
|
if File.directory?(".ebextensions/") || @ext || @ext_role
|
43
|
-
zip = "#{version}.zip"
|
60
|
+
zip = "#{@project_root}#{version}.zip"
|
44
61
|
merge_extensions
|
45
62
|
puts "The following files are being zipped".yellow
|
46
63
|
system('ls -l /tmp/merged_extensions/.ebextensions/')
|
data/lib/gantree/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Gantree::DeployVersion do
|
4
|
+
before(:all) do
|
5
|
+
end
|
6
|
+
|
7
|
+
after(:all) do
|
8
|
+
FileUtils.rm_f(Dir.glob("spec/fixtures/project/*.zip"))
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should create package version" do
|
12
|
+
@options = {
|
13
|
+
:ext => "git@github.com:br/.ebextensions.git",
|
14
|
+
:tag => "br-develop_mkemnitz-30b9bf6",
|
15
|
+
:image_path => "bleacher/carburetor",
|
16
|
+
:project_root => "spec/fixtures/project/"
|
17
|
+
}
|
18
|
+
@env = "stag-carburetor-app-s1"
|
19
|
+
@version = Gantree::DeployVersion.new(@options, @env)
|
20
|
+
packaged_version = @version.run
|
21
|
+
expect(File.exist?(packaged_version)).to be true
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should add auth info" do
|
25
|
+
@options = {
|
26
|
+
:ext => "git@github.com:br/.ebextensions.git",
|
27
|
+
:tag => "br-develop_mkemnitz-30b9bf6",
|
28
|
+
:image_path => "bleacher/carburetor",
|
29
|
+
:project_root => "spec/fixtures/project/",
|
30
|
+
:auth => "docker-cfgs/brops.dockercfg"
|
31
|
+
}
|
32
|
+
@env = "stag-carburetor-app-s1"
|
33
|
+
@version = Gantree::DeployVersion.new(@options, @env)
|
34
|
+
@version.set_auth
|
35
|
+
data = JSON.parse(IO.read("/tmp/#{@version.dockerrun_file}"))
|
36
|
+
expect(data["Authentication"]["Bucket"]).to eq "docker-cfgs"
|
37
|
+
expect(data["Authentication"]["Key"]).to eq "brops.dockercfg"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gantree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -315,9 +315,11 @@ files:
|
|
315
315
|
- lib/gantree/release_notes.rb
|
316
316
|
- lib/gantree/update.rb
|
317
317
|
- lib/gantree/version.rb
|
318
|
+
- spec/fixtures/project/Dockerrun.aws.json
|
318
319
|
- spec/lib/gantree/1_release_notes_spec.rb
|
319
320
|
- spec/lib/gantree/cli_spec.rb
|
320
321
|
- spec/lib/gantree/deploy_spec.rb
|
322
|
+
- spec/lib/gantree/deploy_version_spec.rb
|
321
323
|
- spec/lib/gantree/docker_spec.rb
|
322
324
|
- spec/lib/gantree/init_spec.rb
|
323
325
|
- spec/spec_helper.rb
|
@@ -349,9 +351,11 @@ summary: This tool is intended to help you setup a Dockerrun.aws.json which allo
|
|
349
351
|
allows you to do versioned deploys to your Elastic Beanstalk application and create
|
350
352
|
an archive of every versioned Dockerrun.aws.json in amazons s3 bucket service.
|
351
353
|
test_files:
|
354
|
+
- spec/fixtures/project/Dockerrun.aws.json
|
352
355
|
- spec/lib/gantree/1_release_notes_spec.rb
|
353
356
|
- spec/lib/gantree/cli_spec.rb
|
354
357
|
- spec/lib/gantree/deploy_spec.rb
|
358
|
+
- spec/lib/gantree/deploy_version_spec.rb
|
355
359
|
- spec/lib/gantree/docker_spec.rb
|
356
360
|
- spec/lib/gantree/init_spec.rb
|
357
361
|
- spec/spec_helper.rb
|