Getting the error "The local branch <branch name> is behind the remote one, therefore a new version won't be published" during CI #3334
Replies: 6 comments 5 replies
-
in order to support making commits during the release process (even though we recommend avoiding this if you can, we still need to account for it in the core workflow), we need to make sure we are committing to the head of the branch. under normal conditions, this error can mostly be ignored since the next build of that branch (the one triggered by the push that makes the current state behind the remote) will execute semantic-release again and process all of the commits since the previous release.
is there a specific reason you are working around the natural behavior? it seems like you would be making things harder on yourself, at least related to semantic-release |
Beta Was this translation helpful? Give feedback.
-
ok makes sense, but semantic-release is creating a commit on its own by updating the version no? (or changelog) or is that related to plugins? |
Beta Was this translation helpful? Give feedback.
-
It is actually the natural way to do CI to checkout git hash and not branch, because the hash make sure you build what is being asked and not something that may have change in between. Using "devel" may change by the time the CI kicks in, and therefore the build is no longer related to the commit in question. It works normally, but somehow in this particular case we keep hitting this, and I am mostly trying to find the root cause, not blaming something wrong in the tool. |
Beta Was this translation helpful? Give feedback.
-
Thanks, I may have found the problem from your comment. So far the only pattern I can suspect is this: CD start devel = remote/devel that would make sense "if" semantic-release actually fetch the remote again, is that possible? |
Beta Was this translation helpful? Give feedback.
-
I will see if we can "abort" any existing CD job when a CI get merge, and then restarted it to see if this could remove this issue from happening. |
Beta Was this translation helpful? Give feedback.
-
We treat this as an error because we expected a new version to be created (not out of this particular CD run but somehow in the same day), and that on our side there appears to be no additional CD triggered. As such, this may be where the problem lies, where we fail to detect the need to get the CD going again. Will investigate that, thanks for your prompt answers and information, it is appreciated and I think we can close this. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have many repo using semantic-release tool. In one or two repo in particular, I am starting to see the error mention in the title.
During CI we do not pull branches, we pull git commit hash directly.
So I am confused as to why the semantic-release tool case that a local branch is up-to-date or not with the remote, can't the tool use the remote branch instead of trying to use a local branch?
What is the purpose of this error?
Beta Was this translation helpful? Give feedback.
All reactions