Closed fmalorey closed 2 years ago
I tried the following procedure to reproduce the problem, but it doesn't appear.
Create a dedicated public repo on Github.
Here I choose 'will-be-deleted' with a default README
Clone it in a directory independant from Cooker working space.
$ git clone https://github.com/cpb-/will-be-deleted
Modify the README.md
and commit it. Create a first tag and push it.
$ echo 1.0 >> README.md
$ git commit README.md -m 1.0
$ git tag 1.0
$ git push
$ git push --tags`
Create a simple menu named test-menu.json
like this:
{
"sources" : [
{ "url": "https://github.com/cpb-/will-be-deleted.git", "dir": "test-layer", "rev": "1.0" }
],
"layers": [ "will-be-deleted" ],
"builds" : {
"test-build": {
"target" : "test-target"
}
}
}
Initialize Cooker and do a first fetch
.
$ rm -f .cookerconfig
$ cooker init test-menu.json
$ cooker update
Check the README.md
.
$ cat layers/test-layer/README.md
# will-be-deleted
1.0
In the outside repository update the README, add a tag and push.
$ echo "2.0" >> README.md
$ git commit README.md -m 'update'
$ git tag 2.0
$ git push && git push --tags
Edit Cooker menu and update the tag revision.
[...]
{ "url": "https://github.com/cpb-/will-be-deleted.git", "dir": "test-layer", "rev": "2.0" }
[...]
Rerun Cooker to fetch the repo.
$ cooker update
Check if an update has been done:
$ cat layers/test-layer/README.md
# will-be-deleted
1.0
2.0
Indeed, I saw the problem (on another project) when the layer content had been modified between the two calls to cooker cook
In this case, cooker could not fetch the new content. I had to remove the layer manually before re-running Cooker. I suppose that I could have done a git stash; git stash drop
.
This is a reason why I don't often use cook. Maybe we could create a better error message around this problem.
There's an upcoming pull request that displays git
error in case of failure (indicating that the layer has been modified and that the local changes prevent the update).
Maybe we could also had a --drop
command-line option for cooker cook
/ cooker update
that discard any local modifications ?
When updating "rev" param of a git source in my menu.json, a
cooker cook menu.json
command doesn't trigger a new download.This leads to an error on Udpate step ie: "FATAL: Unable to checkout rev".
Workaround found is to manually layer directory to force a new download.