0

I have pre-push hook that executes my unit tests. When tests fail, push failed as well. However this stopped, noticed today, so when my unit tests fail, my code is pushed. Tried to address this by adding set -euo pipefail, but no change, faulty code is still pushed to remote.

This is my whole pre-push:

#!/bin/sh
set -euo pipefail

docker-compose exec my-container composer test

If I run it directly from terminal and tests fail, pre-push fails, exit code is not zero.

Fellow developer has the same script on same GIT version, but it works for him. Edit: after closer look he realized it does not work for him neither. Perhaps something with git version?

Any idea why my push proceeds even though my pre-push hook fails?

JohnyProkie
  • 389
  • 1
  • 6
  • 13
  • "Any idea why my push proceeds even though my pre-push hook fails?" Is your `pre-push` hook actually failing (e.g., returning a non-zero exit code)? It sounds like the answer is "no". Have you explored the exit code of that `docker-compose exec` command? – larsks Mar 23 '22 at 12:02
  • See also https://github.com/docker/compose-cli/issues/1607 – torek Mar 23 '22 at 14:39
  • This is not related to docker-compose as the pre-push script passes exit code of the test, as stated here: "If I run it directly from terminal and tests fail, pre-push fails, exit code is not zero." Also it worked in past, as following sentence implies: "However this stopped, noticed today" – JohnyProkie Mar 24 '22 at 14:30

0 Answers0