nebula-plugins / nebula-release-plugin

Release opinions based around gradle-git
Apache License 2.0
220 stars 56 forks source link

Cannot create git tag with v17.1.0 any more #235

Closed tflatter-exaring closed 7 months ago

tflatter-exaring commented 1 year ago

GRGIT_USER (and I suppose) GRIGT_PASS are not used any more after migrating from v17.0.1 to v17.1.0.

when I do an echo of the variables in the CI-Script (gitlab ci), then I can see that the values are still set. But a git tag cannot be created as the user (see url) is set to default (gitlab-ci-token) and not to the value of GRGIT_USER any more.

After changing nothing but the nebula.release version back to 17.0.1, everything works fine again.

Logfile (real names changed to example):

> Task :build
> Task :generateMetadataFileForLibPublication
> Task :generatePomFileForLibPublication
> Task :artifactoryPublish
> Task :extractModuleInfo
[pool-1-thread-1] Deploying artifact: https://example.jfrog.io/example/libs-release-local/de/example/lib-example/0.33.0/lib-example-0.33.0-sources.jar
[pool-1-thread-1] Deploying artifact: https://example.jfrog.io/example/libs-release-local/de/example/lib-example/0.33.0/lib-example-0.33.0.jar
[pool-1-thread-1] Deploying artifact: https://example.jfrog.io/example/libs-release-local/de/example/lib-example/0.33.0/lib-example-0.33.0.module
[pool-1-thread-1] Deploying artifact: https://example.jfrog.io/example/libs-release-local/de/example/lib-example/0.33.0/lib-example-0.33.0.pom
> Task :artifactoryDeploy
Deploying build info...
Build-info successfully deployed. Browse it in Artifactory under https://example.jfrog.io/example/webapp/builds/lib-example/1673339613763
> Task :release
Tagging repository as v0.33.0
Pushing changes in [v0.33.0] to origin
> Task :release FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':release'.
> org.eclipse.jgit.api.errors.TransportException: https://gitlab-ci-token@git.example.net/group-example/lib-example.git: git-receive-pack not permitted on 'https://gitlab-ci-token@git.example.net/group-example/lib-example.git/'
tflatter-exaring commented 1 year ago

a few weeks later, we had the same problem also with 17.0.1

must be something with transitive dependencies I suppose...

As I wanted to switch from nebula to axion, I saw the following hint there: https://axion-release-plugin.readthedocs.io/en/latest/configuration/ci_servers/#gitlab-ci

NOTE: You need to set the git remote url first, as GitLab's default cloned project url will have added the non repo-write permission gitlab-ci-token to the origin url.

- git remote set-url origin ${CI_SERVER_URL}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git

As I added this line of configuration, it worked again. Please add this also to the nebula documentation.

tflatter-exaring commented 7 months ago

Update for nebula-release since version 18 and greater:

by the removal of grgit, the above variables do not work any more.

the manual configuration step mentioned above must be extended with user and password as follows:

git remote set-url origin ${CI_SERVER_PROTOCOL}://${GRGIT_USER}:${GRGIT_PASS}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git

I re-used the existing variables in my case, so I did not have to rewrite everything.

Additionally (in gitlab-ci) the following config is also necessary:

git config user.name "${GITLAB_USER_NAME}"
git config user.email "${GITLAB_USER_EMAIL}"
EarthCitizen commented 7 months ago

I can confirm that the instructions above from @tflatter-exaring work.

@tflatter-exaring This should be added to the documentation.