captainhook
captainhook copied to clipboard
$STAGED_FILES is empty during ´git commit -a´ in laravel sail containers
@sebastianfeldmann This one is related to https://github.com/captainhook-git/captainhook/issues/178
i just came to the situation that i exactly ran into the same issue - and after diving into the code i found that the git indexfile is again not added to the docker-call
the problem indeed is how laravel sail works - you don't call docker exec in that case but just sail bin captainhook what results in a docker exec .... vendor/bin/captainhook
thats why my config looks like that:
"config": {
"run": {
"mode": "docker",
"exec": "vendor/bin/sail bin",
"path": "captainhook",
"git": "/var/www/html/.git"
}
},
...
finally this is the reason, why it is not attached - the Docker-Template searches for "docker exec" and since this is not there -> no git index file....
the same will happen to people using docker-compose in their own environment... also there you could do something like docker-compose exec service-name vendor/bin/captainhook
The question is: is this a usecase? I can switch to docker exec - sure... But the problem with that is the container-name:
"config": {
"run": {
"mode": "docker",
"exec": "docker exec foldername-containername-1",
"path": "vendor/bin/captainhook",
"git": "/var/www/html/.git"
}
},
with docker-compose/sail the current folder is prefixed to the containername and a number is appended... to fix that, we would have to add a container-name to the docker-compose-file to get a fixed containername... but finally this is all so inconvenient...
isn't it already enough to say: mode=docker? Then it should be clear, that we are inside a docker-container and then if the git-setting is given the env should be set, or not?