awes_cli 0.0.23 → 0.0.24.1
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 +19 -2
- data/lib/deploy_app.rb +18 -5
- data/lib/deploy_config.rb +15 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ef5c6e874ea89e138bafad8036d8ed8f5e31e4f5419e670c7a3357d93a49132
|
4
|
+
data.tar.gz: a60aa781d966c57787301c71a53052a30620de375e89c55f0482b97648cb2e7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de14074f03f0c2a2942c3f66a106dbe96da4304f6653d0f8cfc88df7d54466e08e501c592a467aee87c916c3eb1f428efe20121d1b4366067e6219173383012d
|
7
|
+
data.tar.gz: f7321da9f2ee8699ee691ef021a9ea2e9306b5a7b081b30af23bf74f94ee7729729546f3d55462c6bb7f5099aee83d9e10ac061bd30d5063881f84de702380b8
|
data/lib/build_app_image.rb
CHANGED
@@ -15,10 +15,15 @@ class BuildAppImage
|
|
15
15
|
options = {}
|
16
16
|
|
17
17
|
require_options_keys = [:project_id, :image_repo]
|
18
|
+
optional_options_keys = [:cluster_location, :img_worker_pool]
|
18
19
|
|
19
20
|
opt_parser = OptionParser.new do |opts|
|
20
21
|
opts.banner = "Usage: ather build [options]"
|
21
22
|
|
23
|
+
opts.on("--img-worker-pool IMG_WORKER_POOL", "Img worker pool to build [optional]") do |val|
|
24
|
+
options[:img_worker_pool] = val
|
25
|
+
end
|
26
|
+
|
22
27
|
opts.on("--image-tag IMAGE_TAG", "Addtional Image tag to build [optional]") do |val|
|
23
28
|
options[:image_tag] = val
|
24
29
|
end
|
@@ -31,6 +36,10 @@ class BuildAppImage
|
|
31
36
|
options[:image_repo] = val
|
32
37
|
end
|
33
38
|
|
39
|
+
opts.on("--cluster-location CLUSTER_LOCATION", "App name [required or set env var CLUSTER_LOCATION]") do |val|
|
40
|
+
options[:cluster_location] = val
|
41
|
+
end
|
42
|
+
|
34
43
|
opts.on("-h", "--help", "Prints this help") do
|
35
44
|
puts opts
|
36
45
|
exit
|
@@ -48,6 +57,13 @@ class BuildAppImage
|
|
48
57
|
end
|
49
58
|
end
|
50
59
|
|
60
|
+
optional_options_keys.each do |key|
|
61
|
+
options[key] ||= ENV[key.to_s.upcase]
|
62
|
+
if options[key].nil?
|
63
|
+
options.delete(key)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
51
67
|
options
|
52
68
|
end
|
53
69
|
|
@@ -68,8 +84,9 @@ class BuildAppImage
|
|
68
84
|
time_image_url = "#{gcr_url}:#{time_image_tag}".strip
|
69
85
|
|
70
86
|
project_id = options[:project_id]
|
71
|
-
|
72
|
-
|
87
|
+
worker_pool = options.key?(:img_worker_pool) && !options[:img_worker_pool].empty? ? "--worker-pool projects/#{project_id}/locations/#{options[:cluster_location]}/workerPools/#{options[:img_worker_pool]}" : ""
|
88
|
+
|
89
|
+
shell_cmd("gcloud builds submit --project #{project_id} --timeout=20m --tag #{time_image_url} #{worker_pool} || true")
|
73
90
|
|
74
91
|
shell_cmd("gcloud container images add-tag --quiet #{time_image_url} #{commit_image_url}")
|
75
92
|
|
data/lib/deploy_app.rb
CHANGED
@@ -10,9 +10,6 @@ class DeployApp
|
|
10
10
|
|
11
11
|
gcr_url = "asia.gcr.io/#{options[:project_id]}/#{options[:image_repo] || options[:app_name]}"
|
12
12
|
|
13
|
-
self.workload_hash = fetch_worload_yaml(options[:app_name], options[:namespace])
|
14
|
-
throw "Workload does not exists name: #{option[:app_name]} namespace: #{option[:namespace]}" if workload_hash.nil?
|
15
|
-
|
16
13
|
if(!options[:image_tag].nil?)
|
17
14
|
image_url = validate_image_tag_exists?(gcr_url, options[:image_tag])
|
18
15
|
else
|
@@ -27,6 +24,7 @@ class DeployApp
|
|
27
24
|
options = {}
|
28
25
|
|
29
26
|
require_options_keys = [:project_id, :app_name, :namespace, :cluster, :cluster_location]
|
27
|
+
optional_options_keys = [:img_worker_pool]
|
30
28
|
|
31
29
|
opt_parser = OptionParser.new do |opts|
|
32
30
|
opts.banner = "Usage: ather deploy app [options]"
|
@@ -35,6 +33,10 @@ class DeployApp
|
|
35
33
|
options[:approve] = flag
|
36
34
|
end
|
37
35
|
|
36
|
+
opts.on("--img-worker-pool IMG_WORKER_POOL", "Img worker pool to build [optional]") do |val|
|
37
|
+
options[:img_worker_pool] = val
|
38
|
+
end
|
39
|
+
|
38
40
|
opts.on("--image-tag IMAGE_TAG", "Image tag to deploy [optional]") do |val|
|
39
41
|
options[:image_tag] = val
|
40
42
|
end
|
@@ -80,6 +82,13 @@ class DeployApp
|
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
85
|
+
optional_options_keys.each do |key|
|
86
|
+
options[key] ||= ENV[key.to_s.upcase]
|
87
|
+
if options[key].nil?
|
88
|
+
options.delete(key)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
83
92
|
options
|
84
93
|
end
|
85
94
|
|
@@ -119,8 +128,9 @@ class DeployApp
|
|
119
128
|
time_image_url = "#{gcr_url}:#{time_image_tag}".strip
|
120
129
|
|
121
130
|
project_id = options[:project_id]
|
122
|
-
|
123
|
-
|
131
|
+
worker_pool = options.key?(:img_worker_pool) && !options[:img_worker_pool].empty? ? "--worker-pool projects/#{project_id}/locations/#{options[:cluster_location]}/workerPools/#{options[:img_worker_pool]}" : ""
|
132
|
+
|
133
|
+
shell_cmd("gcloud builds submit --project #{project_id} --timeout=20m --tag #{time_image_url} #{worker_pool} || true")
|
124
134
|
|
125
135
|
shell_cmd("gcloud container images add-tag --quiet #{time_image_url} #{commit_image_url}")
|
126
136
|
|
@@ -134,6 +144,9 @@ class DeployApp
|
|
134
144
|
"--project #{options[:project_id]} "
|
135
145
|
)
|
136
146
|
|
147
|
+
self.workload_hash = fetch_worload_yaml(options[:app_name], options[:namespace])
|
148
|
+
throw "Workload does not exists name: #{options[:app_name]} namespace: #{options[:namespace]}" if workload_hash.nil?
|
149
|
+
|
137
150
|
app_name = options[:app_name]
|
138
151
|
shell_cmd("kubectl set image #{workload_hash['kind']} #{app_name} #{app_name}=#{image_url} -n #{options[:namespace]}")
|
139
152
|
|
data/lib/deploy_config.rb
CHANGED
@@ -24,6 +24,7 @@ class DeployConfig
|
|
24
24
|
options = {}
|
25
25
|
|
26
26
|
require_options_keys = [:project_id, :app_name, :namespace, :cluster, :cluster_location, :kuztomize_env]
|
27
|
+
optional_options_keys = [:cluster_location, :img_worker_pool]
|
27
28
|
|
28
29
|
opt_parser = OptionParser.new do |opts|
|
29
30
|
opts.banner = "Usage: ather deploy config [options]"
|
@@ -32,6 +33,10 @@ class DeployConfig
|
|
32
33
|
options[:approve] = flag
|
33
34
|
end
|
34
35
|
|
36
|
+
opts.on("--img-worker-pool IMG_WORKER_POOL", "Img worker pool to build [optional]") do |val|
|
37
|
+
options[:img_worker_pool] = val
|
38
|
+
end
|
39
|
+
|
35
40
|
opts.on("--image-tag IMAGE_TAG", "Image tag to deploy [optional]") do |val|
|
36
41
|
options[:image_tag] = val
|
37
42
|
end
|
@@ -81,6 +86,13 @@ class DeployConfig
|
|
81
86
|
end
|
82
87
|
end
|
83
88
|
|
89
|
+
optional_options_keys.each do |key|
|
90
|
+
options[key] ||= ENV[key.to_s.upcase]
|
91
|
+
if options[key].nil?
|
92
|
+
options.delete(key)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
84
96
|
options
|
85
97
|
end
|
86
98
|
|
@@ -133,8 +145,9 @@ class DeployConfig
|
|
133
145
|
time_image_url = "#{gcr_url}:#{time_image_tag}".strip
|
134
146
|
|
135
147
|
project_id = options[:project_id]
|
136
|
-
|
137
|
-
|
148
|
+
worker_pool = options.key?(:img_worker_pool) && !options[:img_worker_pool].empty? ? "--worker-pool projects/#{project_id}/locations/#{options[:cluster_location]}/workerPools/#{options[:img_worker_pool]}" : ""
|
149
|
+
|
150
|
+
shell_cmd("gcloud builds submit --project #{project_id} --timeout=20m --tag #{time_image_url} #{worker_pool} || true")
|
138
151
|
|
139
152
|
shell_cmd("gcloud container images add-tag --quiet #{time_image_url} #{commit_image_url}")
|
140
153
|
|
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.24.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Umar Siddiqui
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ather cli tool
|
14
14
|
email: umar.siddiqui@atherenergy.com
|
@@ -26,7 +26,7 @@ homepage: https://rubygems.org/gems/awes_cli
|
|
26
26
|
licenses:
|
27
27
|
- MIT
|
28
28
|
metadata: {}
|
29
|
-
post_install_message:
|
29
|
+
post_install_message:
|
30
30
|
rdoc_options: []
|
31
31
|
require_paths:
|
32
32
|
- lib
|
@@ -41,8 +41,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
requirements: []
|
44
|
-
rubygems_version: 3.1
|
45
|
-
signing_key:
|
44
|
+
rubygems_version: 3.0.3.1
|
45
|
+
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: Ather cli tool
|
48
48
|
test_files: []
|