semantic-release: Unable to push to unqualified destination
Current behavior
semantic-release throws an error from the Jenkins job.
Expected behavior
The release process runs correctly and the tag is created in the repository (Bitbucket).
Environment
- semantic-release version:
^15.13.12
- CI environment: Jenkins
- Plugins used:
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
- semantic-release configuration:
"release": {
"pkgRoot": "dist/@company/ngx-library",
"branch": "origin/semantic-release-config-test",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
]
}
- CI logs:
2019-05-14T09:41:14.543Z semantic-release:git Error: Command failed: git push --dry-run ssh://git@bitbucket.company/path/to/my/repo.git HEAD:origin/semantic-release-config-test
error: unable to push to unqualified destination: origin/semantic-release-config-test
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'ssh://git@bitbucket.company/path/to/my/repo.git'
at makeError (/var/lib/jenkins/jobs/AppDesign/jobs/semantic-release POC/workspace/node_modules/semantic-release/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/var/lib/jenkins/jobs/AppDesign/jobs/semantic-release POC/workspace/node_modules/semantic-release/node_modules/execa/index.js:278:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
2019-05-14T09:41:14.631Z semantic-release:git Error: Command failed: git push --dry-run ssh://git@bitbucket.company/path/to/my/repo.git HEAD:origin/semantic-release-config-test
error: unable to push to unqualified destination: origin/semantic-release-config-test
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'ssh://git@bitbucket.company/path/to/my/repo.git'
at makeError (/var/lib/jenkins/jobs/AppDesign/jobs/semantic-release POC/workspace/node_modules/semantic-release/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/var/lib/jenkins/jobs/AppDesign/jobs/semantic-release POC/workspace/node_modules/semantic-release/node_modules/execa/index.js:278:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
2019-05-14T09:41:14.730Z semantic-release:git Error: Command failed: git merge-base --is-ancestor HEAD
fatal: Not a valid object name undefined
at makeError (/var/lib/jenkins/jobs/AppDesign/jobs/semantic-release POC/workspace/node_modules/semantic-release/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/var/lib/jenkins/jobs/AppDesign/jobs/semantic-release POC/workspace/node_modules/semantic-release/node_modules/execa/index.js:278:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
2019-05-14T09:41:14.730Z semantic-release:git Error: Command failed: git merge-base --is-ancestor HEAD
fatal: Not a valid object name undefined
at makeError (/var/lib/jenkins/jobs/AppDesign/jobs/semantic-release POC/workspace/node_modules/semantic-release/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/var/lib/jenkins/jobs/AppDesign/jobs/semantic-release POC/workspace/node_modules/semantic-release/node_modules/execa/index.js:278:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
[09:41:14] [semantic-release] › ℹ The local branch origin/semantic-release-config-test is behind the remote one, therefore a new version won't be published.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (8 by maintainers)
Hi,
I had the same issue and was not related to semantic-release but to how Jenkins checks out the branches (detached as
origin/semantic-release-config-test
)You just need to check it out to “Check out to specific local branch” and give it your desired branch name (
semantic-release-config-test
).That works fine with:
and config (in package.json)
I have spend most of the day banging my head with this issue… just as I remember the “detached” Jenkins “feature”.
Woowww thank you!!! I finally managed to run the semantic-release command from the Jenkins job with this configuration:
And this is the semantic-release configuration in package.json:
That’s it!