awes_cli 0.0.1 → 0.0.7

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
  SHA256:
3
- metadata.gz: be520b19b3caa21d29f8208eab535c95e728180b7c74e77feb477263933587f4
4
- data.tar.gz: 1233834f30464477ec72c618857d980bd68c2d750ce5c8cbd508a98db8876371
3
+ metadata.gz: df13512eaa1e69d2b5a6e0e053fa3ef1fb5a8d840ae0b3a2cf44cd734f899d7a
4
+ data.tar.gz: 929a008841be798c8fc952c913f34755322ac5ffc3490f921167c6946a645c19
5
5
  SHA512:
6
- metadata.gz: 655d71c2e1f7563b8bd6f414f2e3ca73ee5a4c50713ab9009dc9a5709a30866682494cd1d2ddf6edd8bc8d8fa2e47d39cf2ae2c57c12bdf76ed45accd4671fa4
7
- data.tar.gz: e4133b8c0233f5f89352e968daeaad5f31f837b1f0adeed939b83bd986e9d476dcf5e6f6ab8b52d6c56d4ad559754e44e656cad31dbdb21ae1203f15fc39d4b8
6
+ metadata.gz: dc58d40330cecb711cd4e9b11667c136d64679015089db3216fa1066c75847b2c3473dae5609e38044dfc9cc43f094beab7d3e51f866286c7fdd0c26f9199659
7
+ data.tar.gz: e7205d85c8a78a13945557b53f1b035781436c1f36f45cc27b91e66d1b5752fe619e30ee3d70b128f7376fb1f2bba6fd94a921e935c8e888563908f3345d11bb
@@ -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 deploy [optional]") do |val|
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
- shell_cmd("gcloud container images describe #{image_url}")
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
 
@@ -141,17 +157,21 @@ class DeployConfig
141
157
  env_key = env_name[1..-1]
142
158
  env_val = override_envs[env_key] || ENV[env_key] || k8s_deployment_envs[env_key]
143
159
  next if env_val.nil?
144
- yaml_file[env_name] = env_val
160
+ yaml_file[env_name] = "'" + env_val + "'"
145
161
  end
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
- validate_image_tag_exists?(image_url)
167
+ # image_url = opt_image_url || spec[:image] || "#{gcr_url}:current"
168
+ image_url = spec[:image] || "#{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['$IMAGE_URL'] = image_url
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.1
4
+ version: 0.0.7
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-07-22 00:00:00.000000000 Z
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