bosh-workspace 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bosh/cli/commands/prepare.rb +4 -1
- data/lib/bosh/workspace/project_deployment.rb +1 -0
- data/lib/bosh/workspace/release.rb +15 -9
- data/lib/bosh/workspace/version.rb +1 -1
- data/spec/commands/prepare_spec.rb +11 -5
- data/spec/project_deployment_spec.rb +14 -3
- data/spec/release_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 509af72a3d60e92cdfc60b4e3f27d7ca4590b569
|
4
|
+
data.tar.gz: a67937d21657958dcad54f43617df73e97cb2def
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4261f81472671a031ebd91cfb7948730b0f9690ce8de410ea9f0b5f679d2c2fe6e83ce473580bd1b60d44dbfafe92fb470d500ce60eea709251b70aeb2a9ad98
|
7
|
+
data.tar.gz: ea63269675c3184df76c34c08ca7d6e6777a231687674749c309431a972d6888b6b1074d36d6811e1798d73ff4e86ce909cc7f81ce0d24ff164b3a1cc3a0ab09
|
@@ -27,7 +27,10 @@ module Bosh::Cli::Command
|
|
27
27
|
project_deployment_releases.each do |release|
|
28
28
|
say "Cloning release '#{release.name.make_green}' to satisfy template references"
|
29
29
|
release.update_repo
|
30
|
-
|
30
|
+
msg = "Version '#{release.version.to_s.make_green}'"
|
31
|
+
msg = "Ref '#{release.ref.make_green}'" if release.ref
|
32
|
+
say "#{msg} has been checkout into:"
|
33
|
+
say "- #{release.repo_dir}"
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
@@ -1,19 +1,21 @@
|
|
1
1
|
require "git"
|
2
2
|
module Bosh::Workspace
|
3
3
|
class Release
|
4
|
-
attr_reader :name, :git_uri, :repo_dir
|
4
|
+
attr_reader :name, :git_uri, :repo_dir, :ref
|
5
5
|
|
6
6
|
def initialize(release, releases_dir)
|
7
7
|
@name = release["name"]
|
8
|
-
@
|
8
|
+
@ref = release["ref"]
|
9
|
+
@spec_version = release["version"]
|
9
10
|
@git_uri = release["git"]
|
10
11
|
@repo_dir = File.join(releases_dir, @name)
|
11
12
|
init_repo
|
12
13
|
end
|
13
14
|
|
14
15
|
def update_repo
|
15
|
-
@repo.
|
16
|
-
@repo.checkout
|
16
|
+
@repo.fetch "origin", tags: true
|
17
|
+
@repo.checkout last_commit
|
18
|
+
@repo.checkout ref || version_ref
|
17
19
|
end
|
18
20
|
|
19
21
|
def manifest_file
|
@@ -29,11 +31,11 @@ module Bosh::Workspace
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def version
|
32
|
-
return final_releases.keys.sort.last if @
|
33
|
-
unless final_releases[@
|
34
|
-
err("Could not find version: #{@
|
34
|
+
return final_releases.keys.sort.last if @spec_version == "latest"
|
35
|
+
unless final_releases[@spec_version.to_i]
|
36
|
+
err("Could not find version: #{@spec_version} for release: #{@name}")
|
35
37
|
end
|
36
|
-
@
|
38
|
+
@spec_version.to_i
|
37
39
|
end
|
38
40
|
|
39
41
|
private
|
@@ -49,7 +51,11 @@ module Bosh::Workspace
|
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
52
|
-
def
|
54
|
+
def last_commit
|
55
|
+
@repo.log.object("origin").first
|
56
|
+
end
|
57
|
+
|
58
|
+
def version_ref
|
53
59
|
@repo.log.object(manifest).first
|
54
60
|
end
|
55
61
|
|
@@ -26,9 +26,11 @@ describe Bosh::Cli::Command::Prepare do
|
|
26
26
|
describe "prepare_release(s/_repos)" do
|
27
27
|
let(:releases) { [ release ] }
|
28
28
|
let(:stemcells) { [] }
|
29
|
+
let(:ref) { nil }
|
29
30
|
|
30
31
|
before do
|
31
|
-
expect(release).to receive(:update_repo)
|
32
|
+
expect(release).to receive(:update_repo)
|
33
|
+
expect(release).to receive(:ref).and_return(ref)
|
32
34
|
expect(command).to receive(:release_uploaded?)
|
33
35
|
.with(release.name, release.version).and_return(release_uploaded)
|
34
36
|
end
|
@@ -42,12 +44,16 @@ describe Bosh::Cli::Command::Prepare do
|
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
45
|
-
context "release not uploaded" do
|
47
|
+
context "release not uploaded with ref" do
|
46
48
|
let(:release_uploaded) { false }
|
49
|
+
let(:ref) { "0f910f" }
|
47
50
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
+
context "without release ref" do
|
52
|
+
it "does upload the release" do
|
53
|
+
expect(release).to receive(:ref).and_return(ref)
|
54
|
+
expect(command).to receive(:release_upload).with(release.manifest_file)
|
55
|
+
command.prepare
|
56
|
+
end
|
51
57
|
end
|
52
58
|
end
|
53
59
|
end
|
@@ -6,10 +6,16 @@ describe Bosh::Workspace::ProjectDeployment do
|
|
6
6
|
let(:uuid) { "e55134c3-0a63-47be-8409-c9e53e965d5c" }
|
7
7
|
let(:domain_name) { "bosh" }
|
8
8
|
let(:templates) { ["path_to_bar", "path_to_baz"] }
|
9
|
-
let(:releases)
|
10
|
-
{
|
11
|
-
|
9
|
+
let(:releases) do
|
10
|
+
[{
|
11
|
+
"name" => "foo",
|
12
|
+
"version" => release_version,
|
13
|
+
"ref" => release_ref,
|
14
|
+
"git" => "example.com/foo.git"
|
15
|
+
}]
|
16
|
+
end
|
12
17
|
let(:release_version) { 1 }
|
18
|
+
let(:release_ref) { "eb8ccf" }
|
13
19
|
let(:stemcells) { [
|
14
20
|
{ "name" => "bar", "version" => stemcell_version }
|
15
21
|
] }
|
@@ -101,6 +107,11 @@ describe Bosh::Workspace::ProjectDeployment do
|
|
101
107
|
it { should match(/git.*missing/i) }
|
102
108
|
it { should match(/version.*doesn't validate/i) }
|
103
109
|
end
|
110
|
+
|
111
|
+
context "optional ref" do
|
112
|
+
let(:missing) { ["git", "ref"] }
|
113
|
+
it { should match(/git.*missing/i) }
|
114
|
+
end
|
104
115
|
end
|
105
116
|
|
106
117
|
context "stemcells" do
|
data/spec/release_spec.rb
CHANGED
@@ -27,6 +27,18 @@ describe Bosh::Workspace::Release do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
context "specific ref with latest release" do
|
31
|
+
let(:release_data) do
|
32
|
+
{ "name" => name, "version" => "latest", "ref" => "66658", "git" => repo }
|
33
|
+
end
|
34
|
+
|
35
|
+
it "checks out repo" do
|
36
|
+
release.update_repo
|
37
|
+
expect(subject).to match(/foo-2.yml/)
|
38
|
+
expect(subject).to_not match(/foo-3.yml/)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
30
42
|
context "updated version " do
|
31
43
|
let(:version) { "11" }
|
32
44
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-workspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruben Koster
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bosh_cli
|