-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Error whilst using docker for for the FileChanged/TypeOf condition #211
Comments
Can you show the configuration part of the Please provide:
Be sure that your container can execute git and has access to the .git directory. |
The part of the configuration:
The command i ran:
Yes it has access to .git and it can execute |
The question is, where do you execute If you run git commands on the host system and execute the Cap'n inside a container you have to make sure that the Cap'n inside that container has access to a There is another problem however. /**
* Return the FileStaged\OfType restriction information
*
* @return \CaptainHook\App\Hook\Restriction
*/
public static function getRestriction(): Restriction
{
return Restriction::fromArray([Hooks::PRE_COMMIT]);
} You need to use /**
* Return the FileChanged\OfType restriction information
*
* @return \CaptainHook\App\Hook\Restriction
*/
public static function getRestriction(): Restriction
{
return Restriction::fromArray([Hooks::PRE_PUSH, Hooks::POST_CHECKOUT, Hooks::POST_MERGE, Hooks::POST_REWRITE]);
} Maybe I should echo a warning if a condition is wrongly used. But as mentioned before, you have to make sure that the container executing CaptainHook has access to |
I run it on the host system (outside of docker)
My bad, i actually ment
Testet it by putting |
Another test you have to do is to use |
Tried it by putting |
Have you tried to run the Cap'n in debug mode?
or in your configuration
|
I have now added |
Can you post the full output? Of course you can remove all sensitive data like path or command options or even commands. Just to recap. You are running |
Exactly. For more context, i have committed a file with a .php ending to the local repository already and therefore i would expect |
I have decided to make a detailed step by step list so you can reproduce it too.
|
So if I do everything as you described I can reproduce your error. If I add the following to the configuration
I get the following error.
That means the container does not have access to git. Without access to git the Captain can not figure out what files have changed. I'm currently investigating why the Condition is not failing, because without access to |
Ok the problem is the The start and end point of pushes is communicated via
That worked in my case. At least now the Cap'n sees the start and end point of the push and tries to figure out what changed. If the info is missing the Cap'n expects a basically empty push so he isn't doing anything, That's why the It works to the point were the Cap'n tries to figure out what changed. Because for that the Cap'n uses some git commands and without access to git it does not work and crashes. But as soon you pass the |
Thank you for helping!, it now works for me too |
When using the following config
into the
captainhook.json
. This causes the condition to always return false and therefore the action is skipped.I dont know how exactly the software works, but when i looked into the code, it seemed like, that no branchdata + commit was send to to
getStandardInput()
in class\CaptainHook\App\Console\IO\DefaultIo
.In comparison to a previous test (where i removed the config part out of
captainhook.json
) the data could be retrieved from that class and therefore it also worked correct.The text was updated successfully, but these errors were encountered: