awes_cli 0.0.10 → 0.0.14

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: f2bf8402db7e5c099a93c54ecfa9922c669dcd14c8909fda0cec077fd6230aab
4
- data.tar.gz: e69c603d00b5c50eb31a6fa74381128e504feed24b193e19cd4152d45e86e9cf
3
+ metadata.gz: 8903fbd70b0bd55464fd55ab8845a0a37214b8f34284d3da1d63a459d49aeaee
4
+ data.tar.gz: 86ae6456fd0336004905ffed64dc129bcc39891db3b5601a0f7017aa8cabbf2a
5
5
  SHA512:
6
- metadata.gz: 8545a4fce94d82f06c3a4570dfa51239745f54e149fa80aeefb03e12934b2ad74ffc178a4a54e9ab9ac32a7d66e4e5e805f9701943ebee117056e68feb637115
7
- data.tar.gz: 436fe114c02c2d877d040a150f67e2e1261dc1aaf0ab801c3e16f1d0ebcdab37ba8e947d79073773fdf34a54f136429a7c1a1f394879d01f19cb9d0d87390c0b
6
+ metadata.gz: 4cfc3b61ea624cc928eb0f8f17c6c5ea25a5403c837993fbddb87173314637e314b99f440a7241db8d950b87b555480368e622fa23026cb37955e7feea132693
7
+ data.tar.gz: 6669699a03fd769c116100ba9b86c391a8997196454a6f652d5da5cbb3fe3c0c5763d52b4d429280dc344e3f78dc55b3adbcf162019cbad4576927677fbc507b
@@ -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,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]}"
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 = opt_image_url if validate_image_tag_exists?(opt_image_url)
168
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.10
4
+ version: 0.0.14
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-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ather cli tool
14
14
  email: umar.siddiqui@atherenergy.com