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

.git/hooks/commit-msg -> No such file or directory when running Gitlab CI pipeline #170

Closed
oliverkuntze opened this issue Apr 21, 2023 · 7 comments
Labels

Comments

@oliverkuntze
Copy link

Hey,

thank's for your great plugin.

It works like a charm when I push my commits to the remote repository.

However, when Gitlab CI picks up the commit and starts its pipeline(s) I get the following error:

Failed to notify project evaluation listener.
   > /builds/myProject/.git/hooks/commit-msg (No such file or directory)

and the build fails.

Do you have any ideas what I am missing / I can do to solve this?

Cheers

Oliver

@oliverkuntze
Copy link
Author

Is this project dead? A brief note would be highly appreciated.

Cheers

Oliver

@nicolasfara
Copy link
Owner

nicolasfara commented Apr 27, 2023

Hi @oliverkuntze, sorry for the delay. I'm very busy at the moment.
Could you share the pipeline? Or the section which cause the failure?
However, the plugin creates the .git/hooks/commit-msg when gradle is invoked the first time. Before that moment the hook file is not created.

@oliverkuntze
Copy link
Author

Hi @nicolasfara .
Thanks for your reply.
I am testing adding mkdir -p .git/hooks/ and optionally && touch .git/hooks/commit-msg in a before_script im my gradle based tasks atm.
Apparently resolve(".git/hooks/commit-msg") cannot create the hook file if the hooks folder is not existing.
I am not familiar with Kotlin. Does resolve autocreate missing folders? If not, it would be great if you could add that to your plugin.
Cheers
Oliver

@oliverkuntze
Copy link
Author

Adding mkdir -p .git/hooks/ does the trick. However hooks are not executed when merging in Gitlab. But your builds will at least execute.

@nicolasfara
Copy link
Owner

Hi @nicolasfara . Thanks for your reply. I am testing adding mkdir -p .git/hooks/ and optionally && touch .git/hooks/commit-msg in a before_script im my gradle based tasks atm. Apparently resolve(".git/hooks/commit-msg") cannot create the hook file if the hooks folder is not existing. I am not familiar with Kotlin. Does resolve autocreate missing folders? If not, it would be great if you could add that to your plugin. Cheers Oliver

I don't know the GitLab workflow model, but from what you say, I suppose the repository is not cloned in the runner but simply copied? Because if the repo is cloned, git creates the .git folder with the samples hooks.
I can fix this issue in two ways:

  1. Raise a warning if the .git/hooks folder is missing
  2. Create the .git/hooks/commit-msg file manually even if no git repo is configured in CI

Let me know, in your opinion, which is the best option for this kind of scenario.

@oliverkuntze
Copy link
Author

Hi @nicolasfara .
Yes, to speed things up, Gitlab fetches a shallow copy of the git repo.
The .git folder is there. And so are several subfolders inside it.
No" hooks" folder is created this way.
I would suggest to add the creation of the hook folder if it is missing. Right before it.resolve(".git/hooks/commit-msg").writeScript(scriptContent) in ConventionalCommitScript.kt.
Cheers
Oliver

@nicolasfara nicolasfara reopened this Apr 27, 2023
nicolasfara pushed a commit that referenced this issue Apr 27, 2023
## [3.1.1](3.1.0...3.1.1) (2023-04-27)

### Bug Fixes

* create hooks folder when a shallow clone is made (closes [#170](#170)) ([6d67ac6](6d67ac6))
nicolasfara pushed a commit that referenced this issue Apr 27, 2023
## [3.1.1](3.1.0...3.1.1) (2023-04-27)

### Bug Fixes

* create hooks folder when a shallow clone is made (closes [#170](#170)) ([6d67ac6](6d67ac6))

### Build and continuous integration

* **deps:** update actions/checkout action to v3.3.0 ([4a6c1ae](4a6c1ae))
* **deps:** update actions/checkout action to v3.4.0 ([faaa795](faaa795))
* **deps:** update actions/checkout action to v3.5.0 ([b23b914](b23b914))
* **deps:** update actions/checkout action to v3.5.1 ([6c59d73](6c59d73))
* **deps:** update actions/checkout action to v3.5.2 ([ccc7b14](ccc7b14))
* **deps:** update actions/setup-java action to v3.10.0 ([fabc667](fabc667))
* **deps:** update actions/setup-java action to v3.11.0 ([0c8ca45](0c8ca45))

### Dependency updates

* **deps:** update dependency @semantic-release/changelog to v6.0.3 ([d5d80e8](d5d80e8))
* **deps:** update dependency gradle to v8 ([e90d789](e90d789))
* **deps:** update dependency gradle to v8.0.1 ([b71f3dc](b71f3dc))
* **deps:** update dependency gradle to v8.0.2 ([88c6b23](88c6b23))
* **deps:** update dependency gradle-semantic-release-plugin to v1.7.6 ([16192f4](16192f4))
* **deps:** update dependency org.jetbrains.dokka to v1.8.10 ([4956a03](4956a03))
* **deps:** update dependency org.jetbrains.kotlin.jvm to v1.8.10 ([19ef048](19ef048))
* **deps:** update dependency org.jetbrains.kotlin.jvm to v1.8.20 ([a063567](a063567))
* **deps:** update dependency org.jlleitschuh.gradle.ktlint to v11.1.0 ([514b1be](514b1be))
* **deps:** update kotest to v5.5.5 ([73f9450](73f9450))
* **deps:** update kotest to v5.6.0 ([a755720](a755720))
* **deps:** update kotest to v5.6.1 ([32315ca](32315ca))
* **deps:** update node.js to 18.13 ([977fd31](977fd31))
* **deps:** update node.js to 18.14 ([9b6b964](9b6b964))
* **deps:** update node.js to 18.15 ([b6edc88](b6edc88))
* **deps:** update node.js to 18.16 ([b388228](b388228))
* **deps:** update plugin com.gradle.enterprise to v3.12.2 ([193f8fd](193f8fd))
* **deps:** update plugin com.gradle.enterprise to v3.12.3 ([6aa0ff8](6aa0ff8))
* **deps:** update plugin com.gradle.enterprise to v3.12.4 ([7d7c9a5](7d7c9a5))
* **deps:** update plugin com.gradle.enterprise to v3.12.5 ([3cb1b92](3cb1b92))
* **deps:** update plugin com.gradle.enterprise to v3.12.6 ([4a7d9ad](4a7d9ad))
* **deps:** update plugin com.gradle.enterprise to v3.13 ([1e7a01d](1e7a01d))
* **deps:** update plugin conventional-commits to v3.1.0 ([7ab6dd9](7ab6dd9))
* **deps:** update plugin publish to v1.2.0 ([83ad380](83ad380))

### General maintenance

* refactor project structure ([93032ff](93032ff))
@github-actions
Copy link

🎉 This issue has been resolved in version 3.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

2 participants