awes_cli 0.0.2 → 0.0.8
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_config.rb +25 -5
- 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: f592fb11b8a27203b8d6d688db4b7a2b89e2be17d44850a3bf0b360e09a49eb8
|
4
|
+
data.tar.gz: 8c98e882b6ab6b0bb4fcec1cdd84fcc9c3f152018ca2dfa4c9e026cb8adf5d55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 535d02115e845946e825e7ac45113de15927b4c790a8a754e222d201bdb4ae4a8d22edc0098150e9c73ec012ffb79b59de4d8ca205f060efe57d971b66d0811e
|
7
|
+
data.tar.gz: 504489e3f3c1ee620bd2c9fcf93217d49fda51e9d4af8342991b428fae312ac0ac2890823672ba7cdd8a3674c7af5886fceba043efdb417b8c01d5abcfe585ac
|
data/lib/build_app_image.rb
CHANGED
@@ -19,7 +19,7 @@ class BuildAppImage
|
|
19
19
|
opt_parser = OptionParser.new do |opts|
|
20
20
|
opts.banner = "Usage: ather build [options]"
|
21
21
|
|
22
|
-
opts.on("--image-tag IMAGE_TAG", "Image tag to
|
22
|
+
opts.on("--image-tag IMAGE_TAG", "Addtional Image tag to build [optional]") do |val|
|
23
23
|
options[:image_tag] = val
|
24
24
|
end
|
25
25
|
|
data/lib/deploy_config.rb
CHANGED
@@ -119,7 +119,23 @@ class DeployConfig
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def validate_image_tag_exists?(image_url)
|
122
|
-
|
122
|
+
system("gcloud container images describe #{image_url}")
|
123
|
+
end
|
124
|
+
|
125
|
+
def build_image(image_url, gcr_url, options)
|
126
|
+
commit_image_tag = ENV['CI_COMMIT_SHORT_SHA'] || `git rev-parse --short HEAD`
|
127
|
+
time_image_tag=`TZ=IST-5:30 date +'%Y.%m.%d.%HH.%MM.%SS'`
|
128
|
+
commit_image_url = "#{gcr_url}:#{commit_image_tag}".strip
|
129
|
+
time_image_url = "#{gcr_url}:#{time_image_tag}".strip
|
130
|
+
|
131
|
+
project_id = options[:project_id]
|
132
|
+
|
133
|
+
shell_cmd("gcloud builds submit --project #{project_id} --timeout=20m --tag #{time_image_url} || true")
|
134
|
+
|
135
|
+
shell_cmd("gcloud container images add-tag --quiet #{time_image_url} #{commit_image_url}")
|
136
|
+
|
137
|
+
shell_cmd("gcloud container images add-tag --quiet #{time_image_url} #{image_url}")
|
138
|
+
|
123
139
|
image_url
|
124
140
|
end
|
125
141
|
|
@@ -146,12 +162,16 @@ class DeployConfig
|
|
146
162
|
|
147
163
|
gcr_url = "gcr.io/#{options[:project_id]}/#{options[:app_name]}"
|
148
164
|
|
149
|
-
opt_image_url = options[:image_tag] && "#{gcr_url}:#{options[:image_tag]}"
|
165
|
+
# opt_image_url = options[:image_tag] && "#{gcr_url}:#{options[:image_tag]}"
|
150
166
|
|
151
|
-
image_url = opt_image_url || spec[:image] || "#{gcr_url}:current"
|
152
|
-
|
167
|
+
# image_url = opt_image_url || spec[:image] || "#{gcr_url}:current"
|
168
|
+
image_url = "#{gcr_url}:current"
|
169
|
+
|
170
|
+
if !validate_image_tag_exists?(image_url)
|
171
|
+
build_image(image_url, gcr_url, options)
|
172
|
+
end
|
153
173
|
|
154
|
-
yaml_file
|
174
|
+
yaml_file.gsub(/\$IMAGE_URL/, image_url)
|
155
175
|
|
156
176
|
FileUtils.mkdir_p('./tmp')
|
157
177
|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Umar Siddiqui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ather cli tool
|
14
14
|
email: umar.siddiqui@atherenergy.com
|