awes_cli 0.0.11 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 762baa6d19ad8f2222a0587e9f6fa6480616fdeedefe3c31233757a3bd6cf04d
4
- data.tar.gz: 910d6e3701b492d13be6dfd002aa98df457a3eda0b7eb13a055dd8ccdfc77f0e
3
+ metadata.gz: cedee555e6aa2d7cb069dc15ae693bef45387058f5d3c004f5d9e1485fdcd70b
4
+ data.tar.gz: f08103b5a6e4218b4d94ec14450b1540cd96b67f243858bf3fd715dc0e009686
5
5
  SHA512:
6
- metadata.gz: 9bae0f381c1de58cc2a55ac96a4773347a9a530e05a39346622d94f60542584012c6a182745d207a4230700bde70afda9e97cce8f6c35cc5b42eff195a49d448
7
- data.tar.gz: 9bcfbaeacee77563d74ceda83699032fd0ef05867c238857dba38f3f3480f300e12aec87009f736fedfac1af76b11752f6bccea2339d8860b4b71697cee42926
6
+ metadata.gz: 9efc5058b6a755dd32ecd53f330c28e8cc82d1544cc930327b5d59739f41d39cd0cbe6c93454d1de3e6e9a679ccf686ad2127141fbb28850b1104cd030424ee0
7
+ data.tar.gz: 102425e126ce0ac3409c79fe2204fe8c8558b2254f020a62beff0b38ef83d530fcbcde9c4b9c810ec304a3342f48698bcb06f0aed8db8bbdc3ff1d601bb3ed44
@@ -5,7 +5,7 @@ class BuildAppImage
5
5
  def main
6
6
  options = get_options
7
7
 
8
- gcr_url = "gcr.io/#{options[:project_id]}/#{options[:app_name]}"
8
+ gcr_url = "gcr.io/#{options[:project_id]}/#{options[:image_repo]}"
9
9
 
10
10
  image_url = build_image(gcr_url, options)
11
11
  end
@@ -14,7 +14,7 @@ class BuildAppImage
14
14
  def get_options
15
15
  options = {}
16
16
 
17
- require_options_keys = [:project_id, :app_name]
17
+ require_options_keys = [:project_id, :image_repo]
18
18
 
19
19
  opt_parser = OptionParser.new do |opts|
20
20
  opts.banner = "Usage: ather build [options]"
@@ -27,8 +27,8 @@ class BuildAppImage
27
27
  options[:project_id] = val
28
28
  end
29
29
 
30
- opts.on("--app-name APP_NAME", "K8s app name [required or set env var APP_NAME]") do |val|
31
- options[:app_name] = val
30
+ opts.on("--image-repo IMAGE_REPO", "Image repo to deploy [required or set env var IMAGE_REPO]") do |val|
31
+ options[:image_repo] = val
32
32
  end
33
33
 
34
34
  opts.on("-h", "--help", "Prints this help") do
@@ -76,7 +76,6 @@ class BuildAppImage
76
76
  opt_image_url = options[:image_tag] && "#{gcr_url}:#{options[:image_tag]}"
77
77
 
78
78
  opt_image_url && shell_cmd("gcloud container images add-tag --quiet #{time_image_url} #{opt_image_url}")
79
-
80
- opt_image_url
79
+ shell_cmd("echo \"IMAGE_TAG=#{commit_image_tag}\" >> build.env")
81
80
  end
82
81
  end
data/lib/deploy_app.rb CHANGED
@@ -6,7 +6,7 @@ class DeployApp
6
6
  options = get_options
7
7
  take_approval(options)
8
8
 
9
- gcr_url = "gcr.io/#{options[:project_id]}/#{options[:app_name]}"
9
+ gcr_url = "gcr.io/#{options[:project_id]}/#{options[:image_repo] || options[:app_name]}"
10
10
 
11
11
  if(!options[:image_tag].nil?)
12
12
  image_url = validate_image_tag_exists?(gcr_url, options[:image_tag])
@@ -34,6 +34,10 @@ class DeployApp
34
34
  options[:image_tag] = val
35
35
  end
36
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
+
37
41
  opts.on("--project-id PROJECT_ID", "GCP project id [required or set env var PROJECT_ID]") do |val|
38
42
  options[:project_id] = val
39
43
  end
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,14 +159,14 @@ 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.gsub!(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]}"
165
+ gcr_url = "gcr.io/#{options[:project_id]}/#{options[:image_repo] || options[:app_name]}"
164
166
  opt_image_url = options[:image_tag] && "#{gcr_url}:#{options[:image_tag]}"
165
167
 
166
168
  image_url = "#{gcr_url}:current"
167
- image_url = spec[:image] if validate_image_tag_exists?(spec[:image])
169
+ image_url = spec[:image] if spec[:image] && spec[:image]validate_image_tag_exists?(spec[:image])
168
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)
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.11
4
+ version: 0.0.15
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-10-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ather cli tool
14
14
  email: umar.siddiqui@atherenergy.com