prima-twig 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/twig-deploy +55 -18
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14f41b618524f4a74e631876dadac8fbdce9eae3
4
- data.tar.gz: 32c0b37bef2be34d311c2e403e6d72d9791e8d01
3
+ metadata.gz: b0a9bbe477d44b3f2833ea3c4b45dada8a772623
4
+ data.tar.gz: e1deca4eee0e6654e41431099466246814b0af6e
5
5
  SHA512:
6
- metadata.gz: 1430375d556637f94253201e2b511728832d966e19f8bdac0995a5ba4bfc7d464a7ab6d63ce6ceab268e3c88b01191c69891d0c4d903977a3154efa5da2f0415
7
- data.tar.gz: e80df85d1aae33a4d5c4508d23172aa03bdf93abd34345baf9dfa6459a3b11b6e9faf4d705a22f0f6f3491b4da8ced55565f726ef27621813f56624b6a8705a8
6
+ metadata.gz: 4cd7c56169222c763d66e08ef477a921ee4db31d9346fd18b9501de8b54441de21298d3f7b2515aa3c421d7197f7a58465c7107218bd1714c440ea5b8dffa8a9
7
+ data.tar.gz: d88ea41c43feb4e3285fd237d70c820d18e5c393f5b01689e244aef798394196f9b93663b14861f414529bc2e37caa2a44119fa91ca6413300fecbf3ecf0cd8d
data/bin/twig-deploy CHANGED
@@ -51,7 +51,20 @@ class Review
51
51
  @s3 = Aws::S3::Client.new
52
52
  end
53
53
 
54
- def execute!
54
+ def execute! args
55
+ unless args.empty?
56
+ case args[0]
57
+ when "parameters"
58
+ reload_parameters!
59
+ else
60
+ stop_if true, [:wrong_args, ['parameters']]
61
+ end
62
+ else
63
+ deploy_revision!
64
+ end
65
+ end
66
+
67
+ def deploy_revision!
55
68
  stop_if @prima.head_detached?, :detached_head
56
69
  stop_if @prima.repo_has_modified_files?, "Non posso deployare con file non commitati"
57
70
 
@@ -73,22 +86,7 @@ class Review
73
86
  user = `git config user.name`
74
87
  artifact = artifacts.select {|v| v[:rev] == artifact_rev}.first
75
88
 
76
- deploy_command = "bin/deploy #{artifact_rev}"
77
-
78
- output "Il comando per il deploy sara': #{deploy_command}".yellow
79
-
80
- exit unless @prima.yesno "Sei sicuro di voler effettuare il deploy in produzione?".blue
81
-
82
- exec_step "git fetch"
83
- exec_step "git checkout #{artifact_rev}"
84
- exec_step deploy_command
85
-
86
- stack_name_web = 'ecs-task-web-production'
87
- stack_name_consumer = 'ecs-task-consumer-production'
88
- stack_name_cron = 'ecs-task-consumer-production'
89
- wait_for_stack_ready(stack_name_web) unless stack_ready?(stack_name_web)
90
- wait_for_stack_ready(stack_name_consumer) unless stack_ready?(stack_name_consumer)
91
- wait_for_stack_ready(stack_name_cron) unless stack_ready?(stack_name_cron)
89
+ do_deploy! artifact_rev
92
90
 
93
91
  output "Avvio paparatzinger per gli screenshot".yellow
94
92
  job_name = launch_paparatzinger(artifact[:commit_msg])
@@ -126,7 +124,46 @@ class Review
126
124
 
127
125
  mail.delivery_method(:smtp, opts)
128
126
  mail.deliver
127
+ end
129
128
 
129
+ def reload_parameters!
130
+ artifact_rev = ''
131
+ resp = @cf.describe_stacks({
132
+ stack_name: "ecs-task-web-production"
133
+ })
134
+ resp.stacks[0].parameters.each do |param|
135
+ if param.parameter_key == 'ReleaseVersion'
136
+ artifact_rev = param.parameter_value
137
+ break
138
+ end
139
+ end
140
+
141
+ do_deploy!(artifact_rev, true)
142
+
143
+ output "\nFinito di aggiornare i parameters.yml\n".green
144
+ end
145
+
146
+ def do_deploy!(artifact_rev, reload_parameters=false)
147
+ deploy_command = "bin/deploy #{artifact_rev}"
148
+ deploy_command << " reloadparameters" if reload_parameters
149
+
150
+ output "Il comando per il deploy sara': #{deploy_command}".yellow
151
+ confirm_message = "Sei sicuro di voler effettuare "
152
+ reload_parameters ? (confirm_message << "il reload dei parameters ") : (confirm_message << " il deploy ")
153
+ confirm_message << "in produzione?"
154
+
155
+ exit unless @prima.yesno confirm_message.blue
156
+
157
+ exec_step "git fetch"
158
+ exec_step "git checkout #{artifact_rev}"
159
+ exec_step deploy_command
160
+
161
+ stack_name_web = 'ecs-task-web-production'
162
+ stack_name_consumer = 'ecs-task-consumer-production'
163
+ stack_name_cron = 'ecs-task-consumer-production'
164
+ wait_for_stack_ready(stack_name_web) unless stack_ready?(stack_name_web)
165
+ wait_for_stack_ready(stack_name_consumer) unless stack_ready?(stack_name_consumer)
166
+ wait_for_stack_ready(stack_name_cron) unless stack_ready?(stack_name_cron)
130
167
  end
131
168
 
132
169
  def get_artifacts
@@ -220,4 +257,4 @@ class Review
220
257
 
221
258
  end
222
259
 
223
- Review.new.execute!
260
+ Review.new.execute! args
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prima-twig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Giachino
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-08-02 00:00:00.000000000 Z
14
+ date: 2016-08-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: twig