-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different git tag refs for same cookbook creates non-unique cookbooks #104
Comments
If we change lib/batali/git.rb It works. This indicates a possible problem with threads trying to set the git log sha here via checkout and running into each other? Or perhaps the first sha in the log doesn't change at the right time? Is there any possible negative side effect of using the ref, which in this case gets set to a tag e.g. v0.0.1 or v0.0.2? |
@sjtindell Hi and thanks for the report! I believe the modification in #105 will resolve the issue. If you are able, can you give it a spin and see if it fixes things up for you? |
Thanks Chris, I appreciate the timely response. But still seeing the same issue with the test repos I posted above. |
When I add the following to ref_dup in lib/batali/git.rb
I see the following on execution. The function is being called many times, and the two refs are correct on the first outputs from each thread, but then there are more calls and the threads are still getting the wrong ref. [batali-test/batali-proj]-> rm -rf cookbooks; rm -rf ~/.batali; rm batali.manifest; batali resolve -I; batali install -I --debug |
I created a PR to your fix branch, it appears to work if we use a class variable for the lock. |
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
The Batali file has the following contents
And the batali-cookbook repo metdata file has the following contents, shortened
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 followsThis 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
Different folders are being created under
/var/folders
, but the contents of them is the same.When we remove the
Thread.new do
andend.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.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.The text was updated successfully, but these errors were encountered: