awes_cli 0.0.20.3 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/build_app_image.rb +1 -1
- data/lib/deploy_app.rb +3 -15
- data/lib/deploy_config.rb +3 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2a2d43790a65fec3fbf577af45029ac11fda9db4032e7c638d59d2fb6bc5937
|
4
|
+
data.tar.gz: f3cba1e770612436ecbf28a521ae5c40137b7d57c1100de52a7263b4e0510308
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d387c3da479c1aed33d6cd3b04843df32c5adefe7c0d087e5ce61888da9c79cdd90ddcf6c0d6b58d243e371b864184e0ff716c1b91cbf24f0c889863d2ff0c5c
|
7
|
+
data.tar.gz: 21952628ca8a2b25fbfc17be51ef5c204096c67e6a8f3ccc3411b1f710f4906923929ace17b3c5bebe2140408727fd96ccffbe65465f2ec6ed8a93ecd64985e7
|
data/lib/build_app_image.rb
CHANGED
data/lib/deploy_app.rb
CHANGED
@@ -2,13 +2,11 @@
|
|
2
2
|
require 'optparse'
|
3
3
|
|
4
4
|
class DeployApp
|
5
|
-
attr_accessor :workload_hash
|
6
|
-
|
7
5
|
def main
|
8
6
|
options = get_options
|
9
7
|
take_approval(options)
|
10
8
|
|
11
|
-
gcr_url = "
|
9
|
+
gcr_url = "gcr.io/#{options[:project_id]}/#{options[:image_repo] || options[:app_name]}"
|
12
10
|
|
13
11
|
if(!options[:image_tag].nil?)
|
14
12
|
image_url = validate_image_tag_exists?(gcr_url, options[:image_tag])
|
@@ -131,21 +129,11 @@ class DeployApp
|
|
131
129
|
"--project #{options[:project_id]} "
|
132
130
|
)
|
133
131
|
|
134
|
-
self.workload_hash = fetch_worload_yaml(options[:app_name], options[:namespace])
|
135
|
-
|
136
132
|
app_name = options[:app_name]
|
137
|
-
shell_cmd("kubectl set image
|
133
|
+
shell_cmd("kubectl set image deployment #{app_name} #{app_name}=#{image_url} -n #{options[:namespace]}")
|
138
134
|
|
139
|
-
shell_cmd("kubectl rollout status
|
135
|
+
shell_cmd("kubectl rollout status deployment/#{app_name} -n #{options[:namespace]}")
|
140
136
|
|
141
137
|
shell_cmd("gcloud container images add-tag --quiet #{image_url} #{gcr_url}:current")
|
142
138
|
end
|
143
|
-
|
144
|
-
def fetch_worload_yaml(app_name, namespace)
|
145
|
-
json_deploy = `kubectl get deployment -n #{namespace} #{app_name} -o json`
|
146
|
-
return JSON.parse(json_deploy) if(json_deploy != "")
|
147
|
-
json_statefulset = `kubectl get statefulset -n #{namespace} #{app_name} -o json`
|
148
|
-
return JSON.parse(json_statefulset) if(json_statefulset != "")
|
149
|
-
throw "Workload does not exists name: #{app_name} namespace: #{namespace}"
|
150
|
-
end
|
151
139
|
end
|
data/lib/deploy_config.rb
CHANGED
@@ -6,8 +6,6 @@ require 'yaml'
|
|
6
6
|
require 'fileutils'
|
7
7
|
|
8
8
|
class DeployConfig
|
9
|
-
attr_accessor :workload_hash
|
10
|
-
|
11
9
|
def main
|
12
10
|
options = get_options
|
13
11
|
|
@@ -164,7 +162,7 @@ class DeployConfig
|
|
164
162
|
yaml_file.gsub!(/\$#{env_key}\s*$/, "'#{env_val}'")
|
165
163
|
end
|
166
164
|
|
167
|
-
gcr_url = "
|
165
|
+
gcr_url = "gcr.io/#{options[:project_id]}/#{options[:image_repo] || options[:app_name]}"
|
168
166
|
opt_image_url = options[:image_tag] && "#{gcr_url}:#{options[:image_tag]}"
|
169
167
|
|
170
168
|
image_url = "#{gcr_url}:current"
|
@@ -185,9 +183,7 @@ class DeployConfig
|
|
185
183
|
|
186
184
|
shell_cmd("kubectl apply -f ./tmp/final.yaml")
|
187
185
|
|
188
|
-
|
189
|
-
|
190
|
-
shell_cmd("kubectl rollout status #{workload_hash['kind']}/#{options[:app_name]} -n #{options[:namespace]}")
|
186
|
+
shell_cmd("kubectl rollout status deployment/#{options[:app_name]} -n #{options[:namespace]}")
|
191
187
|
end
|
192
188
|
|
193
189
|
def override_envs(options)
|
@@ -219,8 +215,7 @@ class DeployConfig
|
|
219
215
|
end
|
220
216
|
|
221
217
|
def app_container_spec(app_name, namespace)
|
222
|
-
|
223
|
-
deploy_containers = `kubectl get #{workload_hash['kind']} -n #{namespace} #{app_name} --output=jsonpath={.spec.template.spec.containers}`
|
218
|
+
deploy_containers = `kubectl get deployment -n #{namespace} #{app_name} --output=jsonpath={.spec.template.spec.containers}`
|
224
219
|
return nil if deploy_containers == ''
|
225
220
|
JSON.parse(deploy_containers, symbolize_names: true).find { |container| container[:name] == app_name }
|
226
221
|
end
|
@@ -234,11 +229,4 @@ class DeployConfig
|
|
234
229
|
|
235
230
|
env_export_cmd
|
236
231
|
end
|
237
|
-
|
238
|
-
def fetch_worload_yaml(app_name, namespace)
|
239
|
-
json_deploy = `kubectl get deployment -n #{namespace} #{app_name} -o json`
|
240
|
-
return JSON.parse(json_deploy) if(json_deploy != "")
|
241
|
-
json_statefulset = `kubectl get statefulset -n #{namespace} #{app_name} -o json`
|
242
|
-
return JSON.parse(json_statefulset) if(json_statefulset != "")
|
243
|
-
end
|
244
232
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awes_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Umar Siddiqui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ather cli tool
|
14
14
|
email: umar.siddiqui@atherenergy.com
|