I am currently trying to use the maven-release-plugin working in jenkins on a Git project.
As shown below, there seems to be a missing reference to HEAD in my remote repository (on the server). This reference is only missing in project where the master branch name has been changed to something else.
10:12 $ git ls-remote https://git.mycompany.com/mycompany/common.git
cb6fd9d62d963e9d20499e7dcfcfc8742e799333 refs/heads/development
5fd387bcbaf56312a108b1e07236a25a325f1a79 refs/heads/production
d5d97e7ce2c634ce5ab8cb7d68a2cf9c67ece2ea refs/tags/1.0.0
1317bcd74008313f0a9933d840fbcd4356ed51c7 refs/tags/1.0.0^{}
It there a way to create that kind of reference either from GitLab or remotely with Git ?
Here is the execution log from the maven-release-plugin:
[INFO] --- maven-release-plugin:2.5.1:perform (default-cli) @ common ---
[INFO] Checking out the project to perform the release ...
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/jobs/common/workspace/common/target && git clone --branch 1.0.1 https://git.mycompany.com/mycompany/common.git /var/lib/jenkins/jobs/common/workspace/common/target/checkout
[INFO] Working directory: /var/lib/jenkins/jobs/common/workspace/common/target
[INFO] Executing: /bin/sh -c cd /tmp && git ls-remote https://git.mycompany.com/mycompany/common.git
[INFO] Working directory: /tmp
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/jobs/common/workspace/common/target/checkout && git fetch https://git.mycompany.com/mycompany/common.git
[INFO] Working directory: /var/lib/jenkins/jobs/common/workspace/common/target/checkout
[ERROR] The git-pull command failed.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] common ............................................. FAILURE [ 32.825 s]
[INFO] common :: common-validation ........................ SKIPPED
[INFO] common :: common-sessions .......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.960 s
[INFO] Finished at: 2015-02-03T10:39:04+01:00
[INFO] Final Memory: 20M/395M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:perform (default-cli) on project common: Unable to checkout from SCM
[ERROR] Provider message:
[ERROR] The git-pull command failed.
[ERROR] Command output:
[ERROR] Cloning into '/var/lib/jenkins/jobs/common/workspace/common/target/checkout'...
[ERROR] Note: checking out '78ec6e9c81d25890de75ce671d809bf5d3949ed8'.
[ERROR]
[ERROR] You are in 'detached HEAD' state. You can look around, make experimental
[ERROR] changes and commit them, and you can discard any commits you make in this
[ERROR] state without impacting any branches by performing another checkout.
[ERROR]
[ERROR] If you want to create a new branch to retain commits you create, you may
[ERROR] do so (now or later) by using -b with the checkout command again. Example:
[ERROR]
[ERROR] git checkout -b new_branch_name
[ERROR]
[ERROR] fatal: Couldn't find remote ref HEAD
[ERROR] Unexpected end of command stream
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
Apparently this was a GitLab-related issue.
The default branch was set but after setting (in project settings) an other branch as default, the HEAD reference appeared :
cb6fd9d62d963e9d20499e7dcfcfc8742e799333 HEAD
cb6fd9d62d963e9d20499e7dcfcfc8742e799333 refs/heads/development
07bef68adb8d10956bdba81d07887f793feab76b refs/heads/production
d5d97e7ce2c634ce5ab8cb7d68a2cf9c67ece2ea refs/tags/1.0.0
1317bcd74008313f0a9933d840fbcd4356ed51c7 refs/tags/1.0.0^{}
I switched it back to the default branch and the HEAD is still there.
And the release process is successful
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With