bosh-gen 0.92.0 → 0.93.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/bosh/gen/bosh-cli-commands.rb +16 -0
- data/lib/bosh/gen/cli.rb +2 -0
- data/lib/bosh/gen/generators/extract_job_generator.rb +30 -21
- data/lib/bosh/gen/generators/extract_package_generator.rb +30 -19
- data/lib/bosh/gen/generators/new_release_generator/templates/README.md.tt +4 -4
- data/lib/bosh/gen/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45918f88e325e22d93f99107fdc2fead2e125813
|
4
|
+
data.tar.gz: 046050e3a5af22580cb57da6e3e89045f4f98763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 364abd05e67751691f519cc459f34d32d5988737f4961d9669228c6fa925575aee63563d11673c68a61374a65f9cda68c9748ffec2a484a0e322f8b20bc54588
|
7
|
+
data.tar.gz: 4ba2284c7218284b9f5dfada1fb29c7534869df3ff24f727296fd6118682465d210994862cb30be2edf2df4fcf76925845a8201ad23e11c94ee9b955f0c83fca
|
data/README.md
CHANGED
@@ -3,6 +3,6 @@ BOSH Generators
|
|
3
3
|
|
4
4
|
Generators for creating and sharing BOSH releases.
|
5
5
|
|
6
|
-
New in 0.90: `
|
6
|
+
New in 0.90: `bosh` support - single `manifests/thing.yml` deployment file
|
7
7
|
|
8
|
-
NOTE: this `
|
8
|
+
NOTE: this `bosh` branch is under construction. README will be re-written as we get towards v1.0
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Bosh
|
2
|
+
module Gen
|
3
|
+
class BoshCli
|
4
|
+
# BoshCli.run("add-blob #{source_path} #{target_path}")
|
5
|
+
def self.run(command)
|
6
|
+
`#{cli_name} #{command}`
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.cli_name
|
10
|
+
@@cli_name ||= begin
|
11
|
+
`which bosh2`.size == 0 ? "bosh" : "bosh2"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/bosh/gen/cli.rb
CHANGED
@@ -13,20 +13,20 @@ module Bosh::Gen
|
|
13
13
|
raise Thor::Error.new("run inside a BOSH release project")
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def check_job_path_is_valid
|
18
18
|
unless File.exist?(source_job_path)
|
19
19
|
raise Thor::Error.new("source job path does not exist")
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def check_job_path_is_a_job
|
24
24
|
parent_dir = File.basename(File.dirname(source_job_path))
|
25
25
|
unless parent_dir == "jobs"
|
26
26
|
raise Thor::Error.new("source jobs path is not a BOSH job")
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def check_job_path_within_release
|
31
31
|
FileUtils.chdir(source_release_path) do
|
32
32
|
unless File.exist?("jobs") && File.exist?("packages")
|
@@ -34,55 +34,64 @@ module Bosh::Gen
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def using_source_release_for_templates
|
39
39
|
source_paths << File.join(source_release_path)
|
40
40
|
end
|
41
41
|
|
42
42
|
def copy_job_dir
|
43
|
-
directory "jobs/#{source_job_name}", "jobs/#{target_job_name}"
|
43
|
+
directory "jobs/#{source_job_name}", "jobs/#{target_job_name}", mode: :preserve
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
def detect_dependent_packages
|
47
47
|
@packages = YAML.load_file(job_dir("spec"))["packages"]
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def copy_dependent_packages
|
51
51
|
@packages.each {|package| directory "packages/#{package}"}
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def copy_package_spec_files
|
55
55
|
@blobs = false
|
56
56
|
@packages.each do |package|
|
57
57
|
spec = source_file("packages", package, "spec")
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
copy_file
|
58
|
+
file_globs = YAML.load_file(spec)["files"]
|
59
|
+
|
60
|
+
file_globs.each do |file_glob|
|
61
|
+
source_files = Dir.glob(File.join(source_release_path, "src", file_glob))
|
62
|
+
source_files.each do |source_path|
|
63
|
+
target_path = source_path.scan(%r{/blobs/(.*)}).flatten.first
|
64
|
+
copy_file(File.join("src", target_path))
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
file_globs.each do |file_glob|
|
69
|
+
source_files = Dir.glob(File.join(source_release_path, "blobs", file_glob))
|
70
|
+
source_files.each do |source_path|
|
71
|
+
target_path = source_path.scan(%r{/blobs/(.*)}).flatten.first
|
72
|
+
BoshCli.run "add-blob #{source_path} #{target_path}"
|
73
|
+
say_status "add-blob", target_path
|
65
74
|
@blobs = true
|
66
75
|
end
|
67
76
|
end
|
68
77
|
end
|
69
78
|
end
|
70
|
-
|
79
|
+
|
71
80
|
def readme
|
72
81
|
if @blobs
|
73
|
-
say_status "readme", "Upload blobs with 'bosh upload
|
82
|
+
say_status "readme", "Upload blobs with 'bosh upload-blobs'"
|
74
83
|
end
|
75
84
|
end
|
76
|
-
|
85
|
+
|
77
86
|
private
|
78
87
|
def source_release_path
|
79
88
|
File.expand_path(File.join(source_job_path, "..", ".."))
|
80
89
|
end
|
81
|
-
|
90
|
+
|
82
91
|
def source_job_name
|
83
92
|
File.basename(source_job_path)
|
84
93
|
end
|
85
|
-
|
94
|
+
|
86
95
|
def target_job_name
|
87
96
|
source_job_name
|
88
97
|
end
|
@@ -90,7 +99,7 @@ module Bosh::Gen
|
|
90
99
|
def job_dir(path="")
|
91
100
|
File.join("jobs", target_job_name, path)
|
92
101
|
end
|
93
|
-
|
102
|
+
|
94
103
|
def source_file(*path)
|
95
104
|
File.join(source_release_path, *path)
|
96
105
|
end
|
@@ -7,13 +7,13 @@ module Bosh::Gen
|
|
7
7
|
include Thor::Actions
|
8
8
|
|
9
9
|
argument :source_package_path
|
10
|
-
|
10
|
+
|
11
11
|
def check_root_is_release
|
12
12
|
unless File.exist?("jobs") && File.exist?("packages")
|
13
13
|
raise Thor::Error.new("run inside a BOSH release project")
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def check_package_path_within_release
|
18
18
|
FileUtils.chdir(source_release_path) do
|
19
19
|
unless File.exist?("jobs") && File.exist?("packages")
|
@@ -21,14 +21,14 @@ module Bosh::Gen
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def check_package_path_is_a_package
|
26
26
|
parent_dir = File.basename(File.dirname(source_package_path))
|
27
27
|
unless parent_dir == "packages"
|
28
28
|
raise Thor::Error.new("source package path is not a BOSH package")
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def using_source_release_for_templates
|
33
33
|
source_paths << File.join(source_release_path)
|
34
34
|
end
|
@@ -39,51 +39,62 @@ module Bosh::Gen
|
|
39
39
|
@packages = [source_package_name]
|
40
40
|
@packages << spec["packages"] if spec["packages"]
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def copy_dependent_packages
|
44
|
-
@packages.each
|
44
|
+
@packages.each do |package|
|
45
|
+
directory "packages/#{package}", mode: :preserve
|
46
|
+
end
|
45
47
|
end
|
46
48
|
|
47
49
|
def copy_package_spec_files
|
48
50
|
@blobs = false
|
49
51
|
@packages.each do |package|
|
50
52
|
spec = source_file("packages", package, "spec")
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
copy_file
|
53
|
+
file_globs = YAML.load_file(spec)["files"]
|
54
|
+
|
55
|
+
file_globs.each do |file_glob|
|
56
|
+
source_files = Dir.glob(File.join(source_release_path, "src", file_glob))
|
57
|
+
source_files.each do |source_path|
|
58
|
+
target_path = source_path.scan(%r{/blobs/(.*)}).flatten.first
|
59
|
+
copy_file(File.join("src", target_path))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
file_globs.each do |file_glob|
|
64
|
+
source_files = Dir.glob(File.join(source_release_path, "blobs", file_glob))
|
65
|
+
source_files.each do |source_path|
|
66
|
+
target_path = source_path.scan(%r{/blobs/(.*)}).flatten.first
|
67
|
+
BoshCli.run "add-blob #{source_path} #{target_path}"
|
68
|
+
say_status "add-blob", target_path
|
58
69
|
@blobs = true
|
59
70
|
end
|
60
71
|
end
|
61
72
|
end
|
62
73
|
end
|
63
|
-
|
74
|
+
|
64
75
|
def readme
|
65
76
|
if @blobs
|
66
77
|
say_status "readme", "Upload blobs with 'bosh upload blobs'"
|
67
78
|
end
|
68
79
|
end
|
69
|
-
|
80
|
+
|
70
81
|
private
|
71
82
|
def source_release_path
|
72
83
|
File.expand_path(File.join(source_package_path, "..", ".."))
|
73
84
|
end
|
74
|
-
|
85
|
+
|
75
86
|
def source_package_name
|
76
87
|
File.basename(source_package_path)
|
77
88
|
end
|
78
|
-
|
89
|
+
|
79
90
|
def package_dir(path="")
|
80
91
|
File.join("packages", source_package_name, path)
|
81
92
|
end
|
82
|
-
|
93
|
+
|
83
94
|
def source_package_dir(path="")
|
84
95
|
File.join(source_release_path, "packages", source_package_name, path)
|
85
96
|
end
|
86
|
-
|
97
|
+
|
87
98
|
def source_file(*path)
|
88
99
|
File.join(source_release_path, *path)
|
89
100
|
end
|
@@ -7,7 +7,7 @@ This BOSH release and deployment manifest deploy a cluster of <%= project_name %
|
|
7
7
|
```
|
8
8
|
export BOSH_ENVIRONMENT=<bosh-alias>
|
9
9
|
export BOSH_DEPLOYMENT=<%= project_name %>
|
10
|
-
|
10
|
+
bosh deploy manifests/<%= project_name %>.yml --vars-store tmp/creds.yml
|
11
11
|
```
|
12
12
|
|
13
13
|
If your BOSH has Credhub, then you can omit `--vars-store` flag. It is used to generate any passwords/credentials/certificates required by `manifests/<%= project_name %>.yml`.
|
@@ -18,9 +18,9 @@ If your BOSH has Credhub, then you can omit `--vars-store` flag. It is used to g
|
|
18
18
|
As a developer of this release, create new releases, upload and deploy them:
|
19
19
|
|
20
20
|
```
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
bosh create-release --force && \
|
22
|
+
bosh -n upload-release && \
|
23
|
+
bosh deploy manifests/<%= project_name %>.yml --vars-store tmp/creds.yml
|
24
24
|
```
|
25
25
|
|
26
26
|
If your BOSH has Credhub, then you can omit `--vars-store` flag. It is used to generate any passwords/credentials/certificates required by `manifests/<%= project_name %>.yml`.
|
data/lib/bosh/gen/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.93.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- bin/bosh-gen
|
160
160
|
- bosh-gen.gemspec
|
161
161
|
- lib/bosh/gen.rb
|
162
|
+
- lib/bosh/gen/bosh-cli-commands.rb
|
162
163
|
- lib/bosh/gen/bosh-config.rb
|
163
164
|
- lib/bosh/gen/cli.rb
|
164
165
|
- lib/bosh/gen/core-ext.rb
|