opentelemetry-go-build-tools
opentelemetry-go-build-tools copied to clipboard
commitChangesToNewBranch failed: invalid merge
When trying to release OpenTelemetry Collector Contrib v0.41.0, once dealing with #46 manually, I ran into the following problem. I noticed that the branch was identical to the state of my workspace after the last run of the multimod. Is this the reason for the failure?
===== Module Set: contrib-base =====
Updating versions for module set...
Updating all module versions in go.mod files...
git branch prerelease_contrib-base_v0.41.0
Committing changes to git with message 'Prepare contrib-base for version v0.41.0'
commitChangesToNewBranch failed: could not commit changes: could not commit changes to git: branch config: invalid merge
make: *** [Makefile:302: multimod-prerelease] Error 1
$ git st
On branch prerelease_contrib-base_v0.41.0
nothing to commit, working tree clean
$ git version
git version 2.33.1
$ git log -1
commit fc4a73eb9ebdeb02c38e67eca9f0f160fa4ae464 (HEAD -> prerelease_contrib-base_v0.41.0, jpkrohling/core/issue4523)
Author: Juraci Paixão Kröhling <[email protected]>
Date: Thu Dec 9 10:46:18 2021 +0100
gomodtidy
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
I also ran into this while doing the opentelemetry-collector v0.47.0 release. I fixed it by nuking the repo and cloning again, but I am not sure why that solved the problem.
@mx-psi @jpkrohling Is this issue still valid? Personally, I have not encountered it for several months.
I did not encounter it on the last two releases for which I was a release manager
I saw this again during the v0.111.0 release
Here are the error logs:
❯ make push-tags MODSET=contrib-base
cd /home/user/Source/otel/opentelemetry-collector-contrib/internal/tools && GOOS="" go build -o /home/user/Source/otel/opentelemetry-collector-contrib/.tools/multimod -trimpath go.opentelemetry.io/build-tools/multimod
/home/user/Source/otel/opentelemetry-collector-contrib/.tools/multimod verify
Using versioning file /home/user/Source/otel/opentelemetry-collector-contrib/versions.yaml
PASS: All modules exist in exactly one set.
PASS: All module versions are valid, and no module sets have same non-zero major version.
Finished checking all stable modules' dependencies.
PASS: Module sets successfully verified.
set -e; for tag in `/home/user/Source/otel/opentelemetry-collector-contrib/.tools/multimod tag -m contrib-base -c HEAD --print-tags | grep -v "Using" `; do \
echo "pushing tag ${tag}"; \
git push [email protected]:open-telemetry/opentelemetry-collector-contrib.git ${tag}; \
done;
Using versioning file /home/user/Source/otel/opentelemetry-collector-contrib/versions.yaml
Tagging commit 47cd38d9815a854873962c17aa8df4bbe71268d8:
v0.111.0
unable to tag modules: unable to load repo config: branch config: invalid merge
Just another report, I saw this while doing the v0.112.0 release. Cloning a fresh copy of the repository also fixed it for me.
I got this on the 0.123.0 release.
Encountered this during the 0.129.0 release. Looking at the code which returns this error, it seems to happen when one of the branches in your .git/config has a merge property that doesn't start with refs/heads/. In my case the culprit was this one:
[branch "define-nil-slice-behavior"]
remote = upstream
pushRemote = upstream
merge = refs/pull/11882/head
vscode-merge-base = origin/main
Commenting out the merge property worked for bypassing the error.
I'm pretty sure this is a branch created using the GitHub CLI tool (something like gh pr checkout 11882). This sounds like it's either a bug in the GitHub CLI (maybe they shouldn't be creating branches like this), or (more likely in my opinion) a bug in go-git, which is too stringent when parsing.
Related upstream issues: go-git/go-git/issues/530 and go-git/go-git/issues/331
Seeing the age of those issues, would it make sense to not wait for a fix and add a workaround in multimod? Or even just a warning about how to work around it manually
Oh, there's already a link to this issue and a workaround listed in the release doc. I'll file a PR to update it with a more surgical workaround then