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

"ambiguous argument 'master...origin/master'" when running on a newly cloned project #40

Closed
jn73 opened this issue Mar 15, 2017 · 4 comments

Comments

@jn73
Copy link

jn73 commented Mar 15, 2017

We have a jenkins job that runs the gitflow:release command. The job will clear the workspace and make a fresh clone for each build/release.

The gitflow:release plugin will fail with this errror:

mvn -B gitflow:release                                                                                                                                                                                                            git:develop
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EventMailService 0.2.35-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- gitflow-maven-plugin:1.4.1:release (default-cli) @ event-mail-service ---
[INFO] Checking for uncommitted changes.
[INFO] Checking for SNAPSHOT versions in dependencies.
[INFO] Fetching remote branch 'origin develop'.
[INFO] Comparing local branch 'develop' with remote 'origin/develop'.
[INFO] Fetching remote branch 'origin master'.
[INFO] Comparing local branch 'master' with remote 'origin/master'.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.717 s
[INFO] Finished at: 2017-03-15T11:05:10+01:00
[INFO] Final Memory: 16M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.4.1:release (default-cli) on project event-mail-service: fatal: ambiguous argument 'master...origin/master': unknown revision or path not in the working tree.
[ERROR] Use '--' to separate paths from revisions, like this:
[ERROR] 'git <command> [<revision>...] -- [<file>...]'
[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:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
At this point I only have a ref to the develop-branch in .git/refs/heads.

If I do a 'git checkout -b master origin/master' the ref to master is added to heads and the plugin is able to make the release.

@aleksandr-m
Copy link
Owner

You mean that there is no master branch on the build machine?
Additional command can be added to try to checkout not existing locally needed branches before releasing. Wdyt?

@jn73
Copy link
Author

jn73 commented Mar 16, 2017

Yes, no master-branch on the build-machine. We have set the develop-branch as default in gitlab, so that branch is checked out by default. I added a pre-build-step in jenkins:

git checkout -b master origin/master; git checkout develop

Then it works.

I'm evaluating switching from jgitflow to this plugin. We have other jobs using jgitflow and didn't have to add this extra step.

I guess that in most "normal" use-cases you will always have checked out master and develop branch locally so this doesn't happen. But as long as you clone a remote repository that has develop-branch as default and run gitflow:release* (without manually checking out master before) this should happen.

@aleksandr-m
Copy link
Owner

@jn73 1.5.0 is out.

@jn73
Copy link
Author

jn73 commented Apr 12, 2017

Thanks! I'll try it out asap 😀

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

No branches or pull requests

2 participants