-
Notifications
You must be signed in to change notification settings - Fork 4
Description
I still haven't tracked down exactly what is happening here, but I believe this is a use case for Batali and therefore a bug.
I have the following internal repos, names shortened
githost/sam.tindell/batali-proj
|_ Batali
githost/sam.tindell/batali-cookbook
|_ metadata.rb
The Batali file has the following contents
Batali.define do
source 'https://supermarket.chef.io'
cookbook 'batali-cookbook', :git => 'git@githost.nevint.com:sam.tindell/batali-cookbook.git', :ref => 'v0.0.1'
cookbook 'batali-cookbook', :git => 'git@githost.nevint.com:sam.tindell/batali-cookbook.git', :ref => 'v0.0.2'
discover true
end
And the batali-cookbook repo metdata file has the following contents, shortened
name 'batali-cookbook'
version '0.0.1'
depends 'sudo'
We create a tag in batali-cookbook for v0.0.1, then bump the metdata version to 0.0.2 and create a tag v0.0.2, both tags off the master branch. In git these tags point go two separate refs.
As I understand the usage of batali, I should be able to specify these two tags in the Batali file, and then in the cookbooks directory after executing batali install -I I should get cookbooks created as follows
[batali-test/batali-proj]-> ls cookbooks
batali-cookbook-0.0.1 batali-cookbook-0.0.2 sudo-5.4.0
This works, the cookbooks are there with different names, but the tags have different refs and should have different contents in their metdata.rb files in each generated cookbook dir.
When we use Threads in the lib/batali/command/install.rb execute function, the contents of the cookbooks is identical. This has been tested with repos from Gitlab, Github, and various directory structures.
I see in the batali cache under ~/.batali/cache/git/git the two different refs are there, and they contain the different contents I want.
But when batali actually does the copy for install, rather than having different contents, batali is putting the same ref contents in both cookbook version dirs under ./cookbooks.
Here is some example output.
Notice here that the Ref for the two different versions of the batali-cookbook is the same
[batali-test/batali-proj]-> rm -rf cookbooks; rm -rf ~/.batali; rm batali.manifest; batali resolve -I; batali install -I --debug
[Batali]: Loading sources... complete!
[Batali]: Performing infrastructure path resolution.
[Batali]: Resolving dependency constraints... complete!
[Batali]: Writing infrastructure manifest file... complete!
[Batali]: Infrastructure manifest solution:
batali-cookbook <0.0.1, 0.0.2>
sudo <5.4.0>
[Batali]: Readying installation destination... complete!
[Batali]: Installing cookbooks...
[DEBUG]: Thread: 70142260907860
UnitInspect: <Batali::Unit:70142256724900 [{"name"=>"sudo", "dependencies"=>[], "version"=>#<Batali::UnitVersion "5.4.0">, "source"=><Batali::Source::Site:70142256441580 [{"type"=>"Batali::Source::Site", "url"=>"https://supermarket.chef.io:443/api/v1/cookbooks/sudo/versions/5.4.0/download", "version"=>"5.4.0"}]>}]>
UnitSource: <Batali::Source::Site:70142256441580>
AssetPath: /Users/sam.tindell/.batali/cache/site/remote_site/aHR0cHM6Ly9zdXBlcm1hcmtldC5jaGVmLmlvOjQ0My9hcGkvdjEvY29va2Jvb2tzL3N1ZG8vdmVyc2lvbnMvNS40LjAvZG93bmxvYWQ=/sudo
FinalPath: cookbooks/sudo-5.4.0
[DEBUG]: Thread: 70142260908040
UnitInspect: <Batali::Unit:70142256751260 [{"name"=>"batali-cookbook", "dependencies"=>[<Batali::UnitDependency type=:runtime name="sudo" requirements="> 0">], "version"=>#<Batali::UnitVersion "**0.0.1**">, "source"=><Batali::Source::Git:70142285328780 [{"type"=>"Batali::Source::Git", "url"=>"git@githost.nevint.com:sam.tindell/batali-cookbook.git", "ref"=>"**96977253ff672da5cef92ce7a7cebc30f8e12cea**", "subdirectory"=>nil, "path"=>"/Users/sam.tindell/.batali/cache/git/git/96977253ff672da5cef92ce7a7cebc30f8e12cea"}]>}]>
UnitSource: <Batali::Source::Git:70142285328780>
AssetPath: /var/folders/bz/kk0v4vb54958z6p25n4xfk7h0000gq/T/d20180627-33337-1pkz6uf
FinalPath: cookbooks/batali-cookbook-0.0.1
[DEBUG]: Thread: 70142260908360
UnitInspect: <Batali::Unit:70142262074580 [{"name"=>"batali-cookbook", "dependencies"=>[<Batali::UnitDependency type=:runtime name="sudo" requirements="> 0">], "version"=>#<Batali::UnitVersion "0.0.2">, "source"=><Batali::Source::Git:70142256754800 [{"type"=>"Batali::Source::Git", "url"=>"git@githost.nevint.com:sam.tindell/batali-cookbook.git", "ref"=>"**96977253ff672da5cef92ce7a7cebc30f8e12cea**", "subdirectory"=>nil, "path"=>"/Users/sam.tindell/.batali/cache/git/git/96977253ff672da5cef92ce7a7cebc30f8e12cea"}]>}]>
UnitSource: <Batali::Source::Git:70142256754800>
AssetPath: /var/folders/bz/kk0v4vb54958z6p25n4xfk7h0000gq/T/d20180627-33337-1glr0al
FinalPath: cookbooks/batali-cookbook-0.0.2
complete!
Different folders are being created under /var/folders, but the contents of them is the same.
When we remove the Thread.new do and end.map(&:join) block wrapping the install code and let it run in the single main thread, we see the following where the refs are different as they should be.
[batali-test/batali-proj]-> rm -rf cookbooks; rm -rf ~/.batali; rm batali.manifest; batali resolve -I; batali install -I --debug
[Batali]: Loading sources... complete!
[Batali]: Performing infrastructure path resolution.
[Batali]: Resolving dependency constraints... complete!
[Batali]: Writing infrastructure manifest file... complete!
[Batali]: Infrastructure manifest solution:
batali-cookbook <0.0.1, 0.0.2>
sudo <5.4.0>
[Batali]: Readying installation destination... complete!
[Batali]: Installing cookbooks...
[DEBUG]: Thread: 70315678054060
UnitInspect: <Batali::Unit:70315674507560 [{"name"=>"batali-cookbook", "dependencies"=>[<Batali::UnitDependency type=:runtime name="sudo" requirements="> 0">], "version"=>#<Batali::UnitVersion **"0.0.2**">, "source"=><Batali::Source::Git:70315698845260 [{"type"=>"Batali::Source::Git", "url"=>"git@githost.nevint.com:sam.tindell/batali-cookbook.git", "ref"=>"**96977253ff672da5cef92ce7a7cebc30f8e12cea**", "subdirectory"=>nil, "path"=>"/Users/sam.tindell/.batali/cache/git/git/96977253ff672da5cef92ce7a7cebc30f8e12cea"}]>}]>
UnitSource: <Batali::Source::Git:70315698845260>
AssetPath: /var/folders/bz/kk0v4vb54958z6p25n4xfk7h0000gq/T/d20180627-33044-197oxgw
FinalPath: cookbooks/batali-cookbook-0.0.2
[DEBUG]: Thread: 70315678054060
UnitInspect: <Batali::Unit:70315698841700 [{"name"=>"batali-cookbook", "dependencies"=>[<Batali::UnitDependency type=:runtime name="sudo" requirements="> 0">], "version"=>#<Batali::UnitVersion "**0.0.1**">, "source"=><Batali::Source::Git:70315675097840 [{"type"=>"Batali::Source::Git", "url"=>"git@githost.nevint.com:sam.tindell/batali-cookbook.git", "ref"=>"**89604365d27a67a753f833eef8e30da08d9a3b26**", "subdirectory"=>nil, "path"=>"/Users/sam.tindell/.batali/cache/git/git/89604365d27a67a753f833eef8e30da08d9a3b26"}]>}]>
UnitSource: <Batali::Source::Git:70315675097840>
AssetPath: /var/folders/bz/kk0v4vb54958z6p25n4xfk7h0000gq/T/d20180627-33044-pl92a1
FinalPath: cookbooks/batali-cookbook-0.0.1
[DEBUG]: Thread: 70315678054060
UnitInspect: <Batali::Unit:70315675091780 [{"name"=>"sudo", "dependencies"=>[], "version"=>#<Batali::UnitVersion "5.4.0">, "source"=><Batali::Source::Site:70315685743140 [{"type"=>"Batali::Source::Site", "url"=>"https://supermarket.chef.io:443/api/v1/cookbooks/sudo/versions/5.4.0/download", "version"=>"5.4.0"}]>}]>
UnitSource: <Batali::Source::Site:70315685743140>
AssetPath: /Users/sam.tindell/.batali/cache/site/remote_site/aHR0cHM6Ly9zdXBlcm1hcmtldC5jaGVmLmlvOjQ0My9hcGkvdjEvY29va2Jvb2tzL3N1ZG8vdmVyc2lvbnMvNS40LjAvZG93bmxvYWQ=/sudo
FinalPath: cookbooks/sudo-5.4.0
complete!
What is going wrong here? Is it the threading or the end.map.(&:join) operation? I do not know enough Ruby to track it down fully.