popito 0.0.2.alpha → 0.0.5.alpha

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: 3a9d70fc64c62da1cec61bd91b7e4b6ae012b2399888cb5eb97fd16896f0d1a5
4
- data.tar.gz: d336b6c6d8deece10e61af4e323c24e1068435fbcff31dfaf2d4f50dadbced60
3
+ metadata.gz: b58e07c048aa5f7e962ee86b515726e89974f5180c646dde771d2a023cb8b7bc
4
+ data.tar.gz: 31949642b3549e1f3921bf0bda7843a4fb8fb283cb90a42442aaf73897c774d1
5
5
  SHA512:
6
- metadata.gz: 991d30945797a6e820660bc9a8211f6a96831f1fc007f11bc42150b076dd696bd736f43cddd4ccdb996ef1021b44316bc1e46a7c9a95a5131124264085fd0aa1
7
- data.tar.gz: f91a46bd0fb607f8ecd00e303149c6c4dca414275ce303a14818a97db351126e5b79d181f5d4262f2683232bf4f98e529ba15389e817954bce3cad1ec6519323
6
+ metadata.gz: 427df89a3fb3482382397425b50a8d704b86610b01c835f915aa24ea35e59e7a25ae6a938f6ffe166223ab6faf757a44addf16e42e40211a97bc6d7b16504109
7
+ data.tar.gz: db3d8b1b3dcdc91a3d2ab2c841bbbbd4cc16beabb59c0bfa79d1aec5b1e1ce499ab00ecdf0959217a74f9bc02fbc46b0f7a2411346aa1be82f678b2c8199701d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- popito (0.0.2.alpha)
4
+ popito (0.0.3.alpha)
5
5
  deep_merge (~> 1.2)
6
6
  erb (~> 2.2)
7
7
  json (~> 2.5)
@@ -24,7 +24,7 @@ GEM
24
24
  json (2.5.1)
25
25
  mime-types (3.3.1)
26
26
  mime-types-data (~> 3.2015)
27
- mime-types-data (3.2021.0704)
27
+ mime-types-data (3.2021.0901)
28
28
  minitar (0.9)
29
29
  netrc (0.11.0)
30
30
  rake (13.0.3)
@@ -35,10 +35,11 @@ GEM
35
35
  netrc (~> 0.8)
36
36
  unf (0.1.4)
37
37
  unf_ext
38
- unf_ext (0.0.7.7)
38
+ unf_ext (0.0.8)
39
39
  yaml (0.1.1)
40
40
 
41
41
  PLATFORMS
42
+ ruby
42
43
  x86_64-darwin-20
43
44
 
44
45
  DEPENDENCIES
data/exe/popito CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
-
3
+ # require 'byebug'
4
4
  require 'optparse'
5
5
  require_relative '../lib/popito/deployer/deployer'
6
6
 
@@ -15,10 +15,11 @@ OptionParser.new do |opts|
15
15
  opts.on('--env ENVIRONMENT', 'It define environment used to build images and deploy files.')
16
16
  opts.on('--endpoint https://popito.mydomain.com', 'It defines popito endpoint.')
17
17
  opts.on('--token POPITO_TOKEN', 'This popito token used to auth this client in a specific project.')
18
+ opts.on('--build-config-json JSON_STRING', 'You can set any build config at execution time.')
18
19
  opts.on('--path ./project_path', 'Root folder of the app.')
19
20
  end.parse!(into: params)
20
21
 
21
- raise ArgumentError, 'You can choose --deploy and --check together.' if params[:check] && params[:deploy]
22
+ raise ArgumentError, 'You can\'t use --deploy and --check together.' if params[:check] && params[:deploy]
22
23
 
23
24
  stages = []
24
25
  stages.push('build') if params[:build]
@@ -26,16 +27,20 @@ stages.push('release') if params[:release]
26
27
  stages.push('check') if params[:check]
27
28
  stages.push('deploy') if params[:deploy]
28
29
 
30
+ build_config = JSON.parse(params[:"build-config-json"] || "{}").merge(
31
+ {
32
+ IMAGE_TAG: params[:tag],
33
+ IMAGE_TAG_ALT: params[:"tag-alt"],
34
+ ENVIRONMENT: params[:env]
35
+ }
36
+ )
37
+
29
38
  config_payload = Popito::ConfigPayload.new(
30
39
  project_path: params[:path],
31
40
  stages: stages,
32
41
  project_token: params[:token],
33
42
  api_endpoint: params[:endpoint],
34
- build_config: {
35
- IMAGE_TAG: params[:tag],
36
- IMAGE_TAG_ALT: params[:tag_alt],
37
- ENVIRONMENT: params[:env]
38
- }
43
+ build_config: build_config
39
44
  )
40
45
 
41
46
  if params[:build] || params[:release]
@@ -15,29 +15,25 @@ module Popito
15
15
 
16
16
  def build
17
17
  yaml_config["build"].each do |build|
18
- build["tags"].each do |tag|
19
- builder = Popito::BuildExecutor::Builders::Docker.new(
20
- root_path: config_payload.project_path,
21
- dockerfile: "#{config_payload.build_path}/#{build['dockerfile']}",
22
- image: build["image"],
23
- tag: tag
24
- )
25
- builder.build
26
- end
18
+ builder = Popito::BuildExecutor::Builders::Docker.new(
19
+ root_path: config_payload.project_path,
20
+ dockerfile: "#{config_payload.build_path}/#{build['dockerfile']}",
21
+ image: build["image"],
22
+ tags: build["tags"]
23
+ )
24
+ builder.build
27
25
  end
28
26
  end
29
27
 
30
28
  def release
31
29
  yaml_config["build"].each do |build|
32
- build["tags"].each do |tag|
33
- builder = Popito::BuildExecutor::Builders::Docker.new(
34
- root_path: config_payload.project_path,
35
- dockerfile: "#{config_payload.build_path}/#{build['dockerfile']}",
36
- image: build["image"],
37
- tag: tag
38
- )
39
- builder.push
40
- end
30
+ builder = Popito::BuildExecutor::Builders::Docker.new(
31
+ root_path: config_payload.project_path,
32
+ dockerfile: "#{config_payload.build_path}/#{build['dockerfile']}",
33
+ image: build["image"],
34
+ tags: build["tags"]
35
+ )
36
+ builder.push
41
37
  end
42
38
  end
43
39
 
@@ -3,12 +3,12 @@ module Popito
3
3
  class BuildExecutor
4
4
  module Builders
5
5
  class Docker
6
- attr_accessor :dockerfile, :image, :tag, :root_path
6
+ attr_accessor :dockerfile, :image, :tags, :root_path
7
7
 
8
- def initialize(root_path:, dockerfile:, image:, tag:)
8
+ def initialize(root_path:, dockerfile:, image:, tags:)
9
9
  self.dockerfile = dockerfile
10
10
  self.image = image
11
- self.tag = tag
11
+ self.tags = tags
12
12
  self.root_path = root_path
13
13
  end
14
14
 
@@ -16,7 +16,7 @@ module Popito
16
16
  puts "Building ..."
17
17
  puts "Dockerfile: #{dockerfile}"
18
18
  puts "Image: #{image}"
19
- puts "Tag: #{tag}"
19
+ puts "Tags: #{tags}"
20
20
  Dir.chdir(root_path)
21
21
  docker_build
22
22
  end
@@ -25,24 +25,27 @@ module Popito
25
25
  puts "Pushing ..."
26
26
  puts "Dockerfile: #{dockerfile}"
27
27
  puts "Image: #{image}"
28
- puts "Tag: #{tag}"
28
+ puts "Tags: #{tags}"
29
29
  docker_push
30
30
  end
31
31
 
32
32
  private
33
33
 
34
34
  def docker_push
35
- puts "#{self.class.name}: docker push #{image_full_name}"
36
- system "docker push #{image_full_name}", exception: true
35
+ tags.each do |tag|
36
+ puts "#{self.class.name}: docker push #{image}:#{tag}"
37
+ system "docker push #{image}:#{tag}", exception: true
38
+ end
37
39
  end
38
40
 
39
41
  def docker_build
40
- puts "#{self.class.name}: docker build #{image_full_name}"
41
- system "docker build -f #{dockerfile} --tag #{image_full_name} .", exception: true
42
- end
43
-
44
- def image_full_name
45
- "#{image}:#{tag}"
42
+ command = "docker build -f #{dockerfile}"
43
+ tags.each do |tag|
44
+ command << " --tag #{image}:#{tag}"
45
+ end
46
+ command << " ."
47
+ puts "#{self.class.name}: #{command}"
48
+ system command, exception: true
46
49
  end
47
50
  end
48
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Popito
4
- VERSION = "0.0.2.alpha"
4
+ VERSION = "0.0.5.alpha"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: popito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.alpha
4
+ version: 0.0.5.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wagner Caixeta
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-06 00:00:00.000000000 Z
11
+ date: 2022-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -102,7 +102,6 @@ executables:
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
- - ".byebug_history"
106
105
  - ".gitignore"
107
106
  - ".gitlab-ci.yml"
108
107
  - ".rubocop.yml"
@@ -130,7 +129,7 @@ metadata:
130
129
  homepage_uri: http://github.com/platbr/popito
131
130
  source_code_uri: http://github.com/platbr/popito
132
131
  changelog_uri: http://github.com/platbr/popito/blob/master/CHANGELOG.md
133
- post_install_message:
132
+ post_install_message:
134
133
  rdoc_options: []
135
134
  require_paths:
136
135
  - lib
@@ -145,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
144
  - !ruby/object:Gem::Version
146
145
  version: 1.3.1
147
146
  requirements: []
148
- rubygems_version: 3.1.4
149
- signing_key:
147
+ rubygems_version: 3.0.3.1
148
+ signing_key:
150
149
  specification_version: 4
151
150
  summary: 'WIP: Build docker images for Rails Projects and deploy it on K8S using a
152
151
  Popito Server.'
data/.byebug_history DELETED
@@ -1,247 +0,0 @@
1
- q
2
- params
3
- q
4
- params
5
- q
6
- params
7
- q
8
- params
9
- q
10
- params[:token]
11
- params
12
- q
13
- params
14
- c
15
- JSON.parse(err.response.body)["message"]
16
- err
17
- q
18
- err
19
- q
20
- n
21
- y
22
- q
23
- err.response.body
24
- err
25
- q
26
- puts caller()
27
- caller()
28
- call()
29
- call
30
- err
31
- err.class
32
- err
33
- err.response
34
- JSON.parse(err.response.body)
35
- JSON.parse(err.response.body)["message"]
36
- err
37
- c
38
- JSON.parse(response.body).class
39
- JSON.parse(response.body)
40
- response.body
41
- n
42
- q
43
- default_headers
44
- q
45
- headers
46
- q
47
- config_payload
48
- continue
49
- x["build"][0]["dockerfile"]
50
- x["build"][0]["targets"]
51
- x["build"][0]
52
- x["build"]
53
- x=YAML.load(File.read("#{config_payload.build_path}/build.yaml"))
54
- x["build"]
55
- x=YAML.load(File.read("#{config_payload.build_path}/build.yaml")).class
56
- x
57
- x["build"]
58
- x=YAML.load(File.read("#{config_payload.build_path}/build.yaml")).class
59
- x[0]
60
- x=YAML.load(File.read("#{config_payload.build_path}/build.yaml")).class
61
- YAML.load(File.read("#{config_payload.build_path}/build.yaml")).class
62
- YAML.load(File.read("#{config_payload.build_path}/build.yaml"))
63
- q
64
- YAML.load(File.read("#{config_payload.project_path}/build.yaml"))
65
- c
66
- continue
67
- z.read
68
- x.read
69
- z = Zlib::GzipReader.new(StringIO.new(body))
70
- body
71
- z = Zlib::GzipReader.new(body)
72
- z = Zlib::GzipReader.new(body)
73
- unzipped = StringIO.new(z.read)
74
- body
75
- c
76
- q
77
- body
78
- c
79
- q
80
- body.size
81
- body
82
- c
83
- q
84
- JSON.parse(err.response.body)["code"]
85
- JSON.parse(err.response.body)
86
- JSON.parse(err.response.body)["codigo"]
87
- JSON.parse(err.response.body)["codigo"] + ""
88
- JSON.parse(err.response.body)["code"] + ""
89
- JSON.parse(err.response.body)["message"]
90
- TypeError.kind_of?(RuntimeError)
91
- JSON.parse('{}')
92
- JSON.parse({})
93
- JSON.parse("")
94
- JSON.parse(nil)
95
- JSON.parse(err.response.body)["message"]
96
- JSON.parse(err.response.body)
97
- ::JSON.parse(err.response.body)
98
- require 'json'
99
- ::JSON.parse(err.response.body)
100
- JSON.parse(err.response.body)
101
- JSON(err.response.body)
102
- err.response.body
103
- err.response
104
- c
105
- q
106
- response
107
- c
108
- q
109
- ARGV[0]
110
- ARGV[1]
111
- continue
112
- y
113
- q
114
- config_payload.project_path
115
- File.expand_path(config_payload.project_path)
116
- q
117
- config_payload.project_path
118
- config_payload
119
- q
120
- c
121
- q
122
- current_scope&.config.nil?
123
- context
124
- current_scope
125
- q
126
- default
127
- context.config
128
- context
129
- current_scope
130
- c
131
- q
132
- config_payload.get_value(key: 'RAILS_RUN_MIGRATES', default: 'false')
133
- q
134
- config_payload.get_value(key: 'ENVIRONMENT')
135
- config_payload.get_value(key: :ENVIRONMENT)
136
- config_payload.get_value(:ENVIRONMENTconfig_payload.get_value(key: :ENVIRONMENT))
137
- config_payload.get_value(:ENVIRONMENT)
138
- q
139
- container[:env]
140
- c
141
- container[:env]
142
- c
143
- container[:env]
144
- c
145
- container[:env]
146
- c
147
- container[:env]
148
- c
149
- container[:env]
150
- c
151
- container[:env]
152
- c
153
- container[:env]
154
- q
155
- continue
156
- q
157
- container[:env]
158
- c
159
- container[:env]
160
- byebug
161
- q
162
- container[:env]
163
- c
164
- container[:env]
165
- c
166
- container[:env]
167
- c
168
- container[:env]
169
- q
170
- continue
171
- config_payload.context.config.ENV
172
- config_payload.context.config.env
173
- config_payload.context.config
174
- container[:env][0]config_payload.context.config
175
- container[:env]
176
- c
177
- container[:env]
178
- c
179
- container[:env]
180
- c
181
- container[:env]
182
- container[:name]
183
- container
184
- config_payload.current_scope.config
185
- q
186
- config_payload.current_scope.config
187
- config_payload.current_scope.name
188
- config_payload.current_scope
189
- c
190
- config_payload.current_scope.config
191
- c
192
- config_payload.current_scope.config
193
- c
194
- config_payload.current_scope.config
195
- c
196
- config_payload.current_scope.config
197
- c
198
- config_payload.current_scope.config
199
- c
200
- config_payload.current_scope.config
201
- c
202
- config_payload.current_scope.config
203
- c
204
- config_payload.current_scope.config
205
- c
206
- config_payload.current_scope.config
207
- q
208
- config_payload.current_scope.config
209
- current_context
210
- current_scope
211
- config_payload
212
- container
213
- container["type"]
214
- container[:type]
215
- c
216
- container[:type]
217
- container["config"]
218
- c
219
- container["config"]
220
- c
221
- container["config"]
222
- c
223
- container["config"]
224
- c
225
- container["config"]
226
- c
227
- container["config"]
228
- q
229
- container["config"]
230
- c
231
- container["config"]
232
- c
233
- container["config"]
234
- c
235
- container["config"]
236
- container.config
237
- container
238
- c
239
- container
240
- container.config
241
- c
242
- container.config
243
- c
244
- container.config
245
- c
246
- container.config
247
- container