awes_cli 0.0.9 → 0.0.13

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/lib/deploy_config.rb +11 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 912c0b612f6528b10417d66d062b3646f0526552c95af03c0d084a1f6f814256
4
- data.tar.gz: 1932373450158a805b021a178067e1ec36163d64bf0675f90929eb7dd7ba44f7
3
+ metadata.gz: 5b9a73dc5dbf7745e69146f02c3374ce6a957e43281ae0503c9ad80c53aa17ce
4
+ data.tar.gz: de4640754c3386a108a1d998932d58f79c7314c1d2d10d36d6c45e0e1f22460e
5
5
  SHA512:
6
- metadata.gz: 48e7098342c9676b5b7e37f95622925835b4f076b823363433912eadc7312356efc4592275c8120f5794ca525d681e1ab3711b3819f970ee59c6fdf82bddb38c
7
- data.tar.gz: 353e9d9422aab3511da8f2c0492ea1386edc2dfa5cc0de08b4a182cc4cf51cfa789d4a94a91bf497f21f24097a932187e2f320bf6e1b507ffee625b3bfe233a5
6
+ metadata.gz: a989510de0b482da03abda2787c0d0a3c4b9b9930bff1b3ed63af0849c205535398beba98789f9d8a43fff67e4af8fd9c28dbfd22b2a315395f1a21f1e842b59
7
+ data.tar.gz: 2125e83e81a46dc3edced849a9a79fab44c786113cdd6a50a66d022b7a90de86045d95cdb25c3aa8b3b6437cd2122bd98f89a75ad467dfc3f36d76735b924115
data/lib/deploy_config.rb CHANGED
@@ -13,9 +13,7 @@ class DeployConfig
13
13
 
14
14
  take_approval_app_env(options)
15
15
 
16
- gcr_url = "gcr.io/#{options[:project_id]}/#{options[:app_name]}"
17
-
18
- deploy_config(gcr_url, options)
16
+ deploy_config(options)
19
17
  end
20
18
 
21
19
  private
@@ -36,6 +34,10 @@ class DeployConfig
36
34
  options[:image_tag] = val
37
35
  end
38
36
 
37
+ opts.on("--image-repo IMAGE_REPO", "Image repo to deploy [optional] default to K8s app name") do |val|
38
+ options[:image_repo] = val
39
+ end
40
+
39
41
  opts.on("--project-id PROJECT_ID", "GCP project id [required or set env var PROJECT_ID]") do |val|
40
42
  options[:project_id] = val
41
43
  end
@@ -139,7 +141,7 @@ class DeployConfig
139
141
  image_url
140
142
  end
141
143
 
142
- def deploy_config(gcr_url, options)
144
+ def deploy_config(options)
143
145
  shell_cmd(
144
146
  "gcloud container clusters get-credentials #{options[:cluster]} " \
145
147
  "--region #{options[:cluster_location]} " \
@@ -157,15 +159,15 @@ class DeployConfig
157
159
  env_key = env_name[1..-1]
158
160
  env_val = override_envs[env_key] || ENV[env_key] || k8s_deployment_envs[env_key]
159
161
  next if env_val.nil?
160
- yaml_file[env_name] = "'" + env_val + "'"
162
+ yaml_file.gsub!(/\$#{env_key}\s*$/, "'#{env_val}'")
161
163
  end
162
164
 
163
- gcr_url = "gcr.io/#{options[:project_id]}/#{options[:app_name]}"
164
-
165
- # opt_image_url = options[:image_tag] && "#{gcr_url}:#{options[:image_tag]}"
165
+ gcr_url = "gcr.io/#{options[:project_id]}/#{options[:image_repo] || options[:app_name]}"
166
+ opt_image_url = options[:image_tag] && "#{gcr_url}:#{options[:image_tag]}"
166
167
 
167
- # image_url = opt_image_url || spec[:image] || "#{gcr_url}:current"
168
168
  image_url = "#{gcr_url}:current"
169
+ image_url = spec[:image] if validate_image_tag_exists?(spec[:image])
170
+ image_url = opt_image_url if validate_image_tag_exists?(opt_image_url)
169
171
 
170
172
  if !validate_image_tag_exists?(image_url)
171
173
  build_image(image_url, gcr_url, options)
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.9
4
+ version: 0.0.13
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-08-18 00:00:00.000000000 Z
11
+ date: 2021-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ather cli tool
14
14
  email: umar.siddiqui@atherenergy.com