Skip to content
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

more reliably disable husky for ci/cd environments #195

Closed
dlants opened this issue Jun 6, 2022 · 6 comments
Closed

more reliably disable husky for ci/cd environments #195

dlants opened this issue Jun 6, 2022 · 6 comments

Comments

@dlants
Copy link

dlants commented Jun 6, 2022

Description

@newrelic/node-native-metrics is a dependency of one of my projects. When running yarn install --verbose on the project, building node-native-metrics failed with:

> yarn install --verbose

...

16:17:33 make: Leaving directory '/home/ubuntu/.cache/yarn/v6/.tmp/cded8684755c48d23b0d82fdddbfc97a.d0b66af020795b3a6552ea31dd3d07b1ba1471ef.prepare/node_modules/@newrelic/native-metrics/build'
16:17:33 gyp info ok 
16:17:33 install successful: _newrelic_native_metrics-7_1_2-native_metrics-83-linux-x64
16:17:33 success Saved lockfile.
16:17:33 $ husky install
16:17:33 husky - not a Git repository, skipping hooks installation
16:17:33 Build step 'Execute shell' marked build as failure

It seems like yarn tried to run the prepare script, which tried to run husky install. That in turn failed, because it did not find itself in a git repo.

This behavior on husky has been a pain point for many people, and they've tried to fix it a bunch of times, though it seems unreliably:

typicode/husky#851

Their current docs provide several options for how to disable husky in various environments: https://typicode.github.io/husky/#/?id=disable-husky-in-cidockerprod

Expected Behavior

We do not attempt to run husky when installing the package as a dependency.

Your Environment

  • yarn 1.22.18
  • installing newrelic/native-metrics 7.1.2
@dlants
Copy link
Author

dlants commented Jun 6, 2022

I should mention, since this repo uses husky v7, I was able to work around this issue by setting:

export HUSKY_SKIP_INSTALL="true"

@bizob2828
Copy link
Member

Thanks @dlants for capturing this issue. It looks like you found a valid workaround for your issue. I will talk to our PM to discuss getting this prioritized

@vidhya03
Copy link

vidhya03 commented Jun 8, 2022

We also faced similar issue. when we are using jhipster framework application.

npm install -g
./gradlew -Pprod -Pwar bootWar --no-daemon -PbuildNumber=$GITHUB_RUN_NUMBER
shell: /bin/bash --noprofile --norc -e -o pipefail {0}
env:
JAVA_HOME_11_x64: /home/actions/actions-runner/_work/_tool/jdk/11.0.15/x64
JAVA_HOME: /home/actions/actions-runner/_work/_tool/jdk/11.0.15/x64
JAVA_HOME_11_X64: /home/actions/actions-runner/_work/_tool/jdk/11.0.15/x64
NEXUS_USERNAME: ***
NEXUS_PASSWORD: ***
npm WARN config global --global, --local are deprecated. Use --location=global instead.
npm ERR! code 127
npm ERR! path /home/actions/actions-runner/_work/sci-mycloud/sci-mycloud
npm ERR! command failed
npm ERR! command sh -c husky install
npm ERR! sh: husky: command not found

@workato-integration
Copy link

@workato-integration
Copy link

@jsumners-nr
Copy link
Contributor

This should be resolved by #238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants