pfab 0.19.0 → 0.20.0
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 +4 -4
- data/.tool-versions +1 -1
- data/CODEOWNERS +1 -0
- data/Gemfile.lock +9 -9
- data/README.markdown +3 -3
- data/lib/pfab/cli.rb +19 -8
- data/lib/pfab/templates/base.rb +10 -1
- data/lib/pfab/templates/cron.rb +6 -1
- data/lib/pfab/templates/daemon.rb +6 -1
- data/lib/pfab/templates/job.rb +6 -1
- data/lib/pfab/templates/web.rb +14 -3
- data/lib/pfab/version.rb +1 -1
- data/pfab.gemspec +2 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae294e06f6c051ecc7a114ce443c26620e95ccad7a51c14f73647b11f49d71a3
|
4
|
+
data.tar.gz: 2f72d8acbd9cac08442e4c8f3aa8e135ccc9830d8e532edfb30ea3d75a2afd00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad8d785eb4d122aa05583f15221ae878b43782eb83b6c3f1b83364d33b543c98a0ae6c68d7b923db4d8d328c9eeec3b00d2ed0ebb8262e9859710eef3d28e4af
|
7
|
+
data.tar.gz: fac2aec3de8fce83b95e1c03af150c48c1b5c21cef4afb25dba5daf57f8e7b39f122fe223184330b36395ec575c052237954551b1c050420fdc4ecd91377c0a6
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby
|
1
|
+
ruby 3.0.3
|
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @prefab-cloud/prefabdevs @prefab-cloud/prefabmaintainers @prefab-cloud/prefabadmins
|
data/Gemfile.lock
CHANGED
@@ -18,7 +18,7 @@ GIT
|
|
18
18
|
GEM
|
19
19
|
remote: https://rubygems.org/
|
20
20
|
specs:
|
21
|
-
activesupport (5.2.
|
21
|
+
activesupport (5.2.4.3)
|
22
22
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
23
23
|
i18n (>= 0.7, < 2)
|
24
24
|
minitest (~> 5.1)
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
coderay (1.1.2)
|
31
31
|
commander (4.4.6)
|
32
32
|
highline (~> 1.7.2)
|
33
|
-
concurrent-ruby (1.1.
|
33
|
+
concurrent-ruby (1.1.9)
|
34
34
|
descendants_tracker (0.0.4)
|
35
35
|
thread_safe (~> 0.3, >= 0.3.1)
|
36
36
|
docile (1.3.1)
|
@@ -53,7 +53,7 @@ GEM
|
|
53
53
|
faraday-net_http_persistent (1.2.0)
|
54
54
|
faraday-patron (1.0.0)
|
55
55
|
faraday-rack (1.0.0)
|
56
|
-
git (1.
|
56
|
+
git (1.11.0)
|
57
57
|
rchardet (~> 1.8)
|
58
58
|
github_api (0.19.0)
|
59
59
|
addressable (~> 2.4)
|
@@ -63,20 +63,20 @@ GEM
|
|
63
63
|
oauth2 (~> 1.0)
|
64
64
|
hashie (3.6.0)
|
65
65
|
highline (1.7.10)
|
66
|
-
i18n (1.
|
66
|
+
i18n (1.8.11)
|
67
67
|
concurrent-ruby (~> 1.0)
|
68
68
|
json (1.8.6)
|
69
69
|
jwt (2.3.0)
|
70
70
|
kamelcase (0.0.2)
|
71
71
|
semver2 (~> 3)
|
72
72
|
method_source (0.9.2)
|
73
|
-
mini_portile2 (2.
|
74
|
-
minitest (5.
|
73
|
+
mini_portile2 (2.8.0)
|
74
|
+
minitest (5.15.0)
|
75
75
|
multi_json (1.15.0)
|
76
76
|
multi_xml (0.6.0)
|
77
77
|
multipart-post (2.1.1)
|
78
|
-
nokogiri (1.
|
79
|
-
mini_portile2 (~> 2.
|
78
|
+
nokogiri (1.13.6)
|
79
|
+
mini_portile2 (~> 2.8.0)
|
80
80
|
racc (~> 1.4)
|
81
81
|
oauth2 (1.4.7)
|
82
82
|
faraday (>= 0.8, < 2.0)
|
@@ -109,7 +109,7 @@ GEM
|
|
109
109
|
test-unit (3.2.9)
|
110
110
|
power_assert
|
111
111
|
thread_safe (0.3.6)
|
112
|
-
tzinfo (1.2.
|
112
|
+
tzinfo (1.2.9)
|
113
113
|
thread_safe (~> 0.1)
|
114
114
|
|
115
115
|
PLATFORMS
|
data/README.markdown
CHANGED
@@ -117,9 +117,9 @@ Releasing
|
|
117
117
|
- modify version.rb
|
118
118
|
- ```bundle exec rake gemspec```
|
119
119
|
- ```git commit ```
|
120
|
-
- ```bundle exec rake git:release```
|
121
|
-
- ```bundle exec rake build```
|
122
|
-
- ```gem push pkg/pfab-0.
|
120
|
+
- ```REMOTE_BRANCH=main LOCAL_BRANCH=main bundle exec rake git:release```
|
121
|
+
- ```REMOTE_BRANCH=main LOCAL_BRANCH=main bundle exec rake build```
|
122
|
+
- ```gem push pkg/pfab-0.15.0.gem```
|
123
123
|
|
124
124
|
Copyright
|
125
125
|
---------
|
data/lib/pfab/cli.rb
CHANGED
@@ -209,11 +209,12 @@ module Pfab
|
|
209
209
|
|
210
210
|
full_image_name = "#{container_repository}/#{image_name}:#{rev}"
|
211
211
|
|
212
|
-
|
212
|
+
# return 0 if image exists 1 if not
|
213
|
+
cmd = "docker manifest inspect #{full_image_name} > /dev/null ; echo $?"
|
213
214
|
say "Looking for images with #{cmd}"
|
214
|
-
existing = `#{cmd}
|
215
|
+
existing = `#{cmd}`.strip
|
215
216
|
|
216
|
-
if
|
217
|
+
if existing == "0" && !force
|
217
218
|
say "Found image #{full_image_name} already, skipping prebuild, build & push"
|
218
219
|
return true
|
219
220
|
end
|
@@ -234,13 +235,23 @@ module Pfab
|
|
234
235
|
end
|
235
236
|
end
|
236
237
|
|
237
|
-
|
238
|
+
build_cmd = "docker build -t #{image_name} --platform amd64 ."
|
239
|
+
puts build_cmd
|
240
|
+
result = system(build_cmd)
|
238
241
|
|
239
|
-
|
240
|
-
|
242
|
+
puts "Build Result #{result}"
|
243
|
+
|
244
|
+
if result
|
245
|
+
puts_and_system "docker tag #{image_name}:latest #{image_name}:#{rev}"
|
246
|
+
puts_and_system "docker tag #{image_name}:#{rev} #{full_image_name}"
|
247
|
+
|
248
|
+
puts_and_system "docker push #{container_repository}/#{image_name}:#{rev}"
|
249
|
+
return true
|
250
|
+
else
|
251
|
+
say "Build Did Not Succeed"
|
252
|
+
return false
|
253
|
+
end
|
241
254
|
|
242
|
-
puts_and_system "docker push #{container_repository}/#{image_name}:#{rev}"
|
243
|
-
return true
|
244
255
|
end
|
245
256
|
|
246
257
|
def yy
|
data/lib/pfab/templates/base.rb
CHANGED
@@ -42,8 +42,17 @@ module Pfab
|
|
42
42
|
}
|
43
43
|
end
|
44
44
|
|
45
|
+
|
46
|
+
def deploy_id
|
47
|
+
"#{@data['application']}.#{application_type}.#{@data['deployed_name']}"
|
48
|
+
end
|
49
|
+
|
45
50
|
def env_vars
|
46
|
-
|
51
|
+
|
52
|
+
env_vars = { "DEPLOYED_NAME" => { value: @data['deployed_name'] },
|
53
|
+
"DEPLOY_ID" => { value: deploy_id },
|
54
|
+
"POD_ID" => { valueFrom: { fieldRef: { fieldPath: 'metadata.name' } } }
|
55
|
+
}
|
47
56
|
|
48
57
|
# load defaults
|
49
58
|
load_env_vars(env_vars, @data.dig("application_yaml", :environment))
|
data/lib/pfab/templates/cron.rb
CHANGED
@@ -5,6 +5,10 @@ module Pfab
|
|
5
5
|
f << YAML.dump(job.deep_stringify_keys)
|
6
6
|
end
|
7
7
|
|
8
|
+
def application_type
|
9
|
+
"cron"
|
10
|
+
end
|
11
|
+
|
8
12
|
def job
|
9
13
|
{
|
10
14
|
apiVersion: "batch/v1beta1",
|
@@ -15,7 +19,8 @@ module Pfab
|
|
15
19
|
labels: {
|
16
20
|
application: @data['application'],
|
17
21
|
"deployed-name" => @data['deployed_name'],
|
18
|
-
"application-type" =>
|
22
|
+
"application-type" => application_type,
|
23
|
+
"deploy-id" => deploy_id
|
19
24
|
}
|
20
25
|
},
|
21
26
|
spec: {
|
@@ -5,6 +5,10 @@ module Pfab
|
|
5
5
|
f << YAML.dump(deployment.deep_stringify_keys)
|
6
6
|
end
|
7
7
|
|
8
|
+
def application_type
|
9
|
+
"daemon"
|
10
|
+
end
|
11
|
+
|
8
12
|
def deployment
|
9
13
|
{
|
10
14
|
kind: "Deployment",
|
@@ -15,7 +19,8 @@ module Pfab
|
|
15
19
|
labels: {
|
16
20
|
application: @data['application'],
|
17
21
|
"deployed-name" => @data['deployed_name'],
|
18
|
-
"application-type" =>
|
22
|
+
"application-type" => application_type,
|
23
|
+
"deploy-id" => deploy_id
|
19
24
|
}
|
20
25
|
},
|
21
26
|
spec: {
|
data/lib/pfab/templates/job.rb
CHANGED
@@ -5,6 +5,10 @@ module Pfab
|
|
5
5
|
f << YAML.dump(job.deep_stringify_keys)
|
6
6
|
end
|
7
7
|
|
8
|
+
def application_type
|
9
|
+
"job"
|
10
|
+
end
|
11
|
+
|
8
12
|
def job
|
9
13
|
{
|
10
14
|
apiVersion: "batch/v1",
|
@@ -15,7 +19,8 @@ module Pfab
|
|
15
19
|
labels: {
|
16
20
|
application: @data['application'],
|
17
21
|
"deployed-name" => @data['deployed_name'],
|
18
|
-
"application-type" =>
|
22
|
+
"application-type" => application_type,
|
23
|
+
"deploy-id" => deploy_id
|
19
24
|
}
|
20
25
|
},
|
21
26
|
spec: {
|
data/lib/pfab/templates/web.rb
CHANGED
@@ -21,7 +21,8 @@ module Pfab
|
|
21
21
|
labels: {
|
22
22
|
application: @data['application'],
|
23
23
|
"deployed-name" => @data['deployed_name'],
|
24
|
-
}
|
24
|
+
},
|
25
|
+
annotations: service_annotations,
|
25
26
|
},
|
26
27
|
spec: {
|
27
28
|
selector: {
|
@@ -38,6 +39,12 @@ module Pfab
|
|
38
39
|
}
|
39
40
|
end
|
40
41
|
|
42
|
+
def service_annotations
|
43
|
+
h = {}
|
44
|
+
h["traefik.ingress.kubernetes.io/service.serversscheme"] = "h2c" if get("protocol") == "h2c"
|
45
|
+
h
|
46
|
+
end
|
47
|
+
|
41
48
|
def ingress
|
42
49
|
{
|
43
50
|
apiVersion: "networking.k8s.io/v1",
|
@@ -107,7 +114,6 @@ module Pfab
|
|
107
114
|
"traefik.ingress.kubernetes.io/router.entrypoints" => "websecure",
|
108
115
|
"traefik.ingress.kubernetes.io/router.tls" => "true"
|
109
116
|
}
|
110
|
-
h["ingress.kubernetes.io/protocol"] = "h2c" if get("protocol") == "h2c"
|
111
117
|
h
|
112
118
|
end
|
113
119
|
|
@@ -130,6 +136,10 @@ module Pfab
|
|
130
136
|
get("readinessProbe") || default_probe
|
131
137
|
end
|
132
138
|
|
139
|
+
def application_type
|
140
|
+
"web"
|
141
|
+
end
|
142
|
+
|
133
143
|
def deployment
|
134
144
|
{
|
135
145
|
kind: "Deployment",
|
@@ -140,7 +150,8 @@ module Pfab
|
|
140
150
|
labels: {
|
141
151
|
application: @data['application'],
|
142
152
|
"deployed-name" => @data['deployed_name'],
|
143
|
-
"application-type" =>
|
153
|
+
"application-type" => application_type,
|
154
|
+
"deploy-id" => deploy_id
|
144
155
|
}
|
145
156
|
},
|
146
157
|
spec: {
|
data/lib/pfab/version.rb
CHANGED
data/pfab.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: pfab 0.
|
5
|
+
# stub: pfab 0.20.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "pfab".freeze
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.20.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pfab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Dwyer
|
@@ -133,6 +133,7 @@ extra_rdoc_files:
|
|
133
133
|
files:
|
134
134
|
- ".document"
|
135
135
|
- ".tool-versions"
|
136
|
+
- CODEOWNERS
|
136
137
|
- Gemfile
|
137
138
|
- Gemfile.lock
|
138
139
|
- LICENSE.txt
|