eb-docker-deploy 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02df66ec1675e50705fdb62095917a230c4b5649
4
- data.tar.gz: f2d019128389c04833cdbba09326e9471e279d63
3
+ metadata.gz: 67b183671bb59c1df4a045ea9c85fb88d3ca4556
4
+ data.tar.gz: db28728d203c093b528cb4409f83223b9f63acf8
5
5
  SHA512:
6
- metadata.gz: b6019431a1df15632b63d6be92bd1e103a2384fb01f521910303cec5b2e1d591d743f26684f734e01715f7dd22811fbad8eaf2c4eea31812d37583ae655bc9a6
7
- data.tar.gz: 680bbd97fa0356a48d08f8a8a80226647cb5c9fe9d7975953b99cff07e0adee9379326a5c740ad73fcfd517dfeae33ae80f7524e6ce884706df3750430797b4d
6
+ metadata.gz: 21a1b760b2c9d75f561ecb477512bbc7e0085877900f789d00e7245feba37e7101806408a089ca68d404eea770993ef89e4d300fa39a3de05fef65bf2d2c2bca
7
+ data.tar.gz: 5b0465af2ebb7557b8c98a0c215318b0da85b32c26681f861b5880665f036841f010626b21609adebb2ffe7f80015fa7df927f9236c21158b296f22d09446ad5
@@ -45,22 +45,29 @@ module Deploy
45
45
  end
46
46
 
47
47
  run_deploy(version)
48
- notifier('', { color: 'good', title: 'Deployment Succeeded!!', text: "The new version is #{version}" })
48
+ notifier('', { color: 'good', title: 'Deployment Succeeded!!', text: "The current version is #{version}" })
49
49
  end
50
50
 
51
51
  method_option :version, aliases: '-v', desc: 'Version'
52
52
  desc 'rollback', 'rollback'
53
53
  def rollback
54
+ check_setup
55
+
54
56
  version = options[:version]
55
57
  (shout('You must pass a version with -v'); exit(1)) unless version
56
58
 
57
59
  repo = ENV['DOCKER_REPO']
58
60
 
61
+ notifier('', { color: '#6080C0', title: "Rollback started", text: "Rolling back to version #{version}" })
62
+
63
+ pull_image(repo, version)
64
+
59
65
  tag_image_as_latest(repo, version)
60
66
 
61
67
  push_image(repo, 'latest')
62
68
 
63
- run_deploy(version)
69
+ run_rollback(version)
70
+ notifier('', { color: 'good', title: 'Rollback Succeeded!!', text: "The current version is #{version}" })
64
71
  end
65
72
 
66
73
  desc 'send test notification', 'send test notification'
@@ -99,12 +106,24 @@ module Deploy
99
106
  exit(1) unless system(command)
100
107
  end
101
108
 
109
+ def pull_image(repo, tag)
110
+ shout "Pulling Docker Image: #{repo}:#{tag}"
111
+ command = "docker pull #{repo}:#{tag}"
112
+ exit(1) unless system(command)
113
+ end
114
+
102
115
  def run_deploy(version)
103
- shout "Deploying #{version} to elastic beanstalk"
116
+ shout "deploying #{version} to elastic beanstalk"
104
117
  command = "eb deploy --label #{version}"
105
118
  exit(1) unless system(command)
106
119
  end
107
120
 
121
+ def run_rollback(version)
122
+ shout "deploying #{version} to elastic beanstalk"
123
+ command = "eb deploy --version #{version}"
124
+ exit(1) unless system(command)
125
+ end
126
+
108
127
  def check_setup
109
128
  (shout('docker not installed'); exit(1)) unless command?('docker')
110
129
  (shout('eb command not installed'); exit(1)) unless command?('eb')
@@ -1,3 +1,3 @@
1
1
  module Deploy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eb-docker-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim