semantic-release
semantic-release copied to clipboard
Don't run in jenkins because the branch is origin/master
Current behavior
When running in Jenkins environment, unable to publish because branch name comes up as origin/master: [semantic-release] › ℹ This test run was triggered on the branch origin/master, while semantic-release is configured to only publish from master, next, develop, beta, therefore a new version won’t be published.
Expected behavior
semantic release process continues with appropriate git branch
Environment
-
semantic-release version:
17.4.3
- CI environment: Jenkins
- Plugins used:
"plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", [ "@semantic-release/changelog", { "changelogFile": "CHANGELOG.md" } ], "@semantic-release/npm", [ "@semantic-release/git", { "assets": [ "package.json", "CHANGELOG.md" ], "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" } ]
- semantic-release configuration: https://pastebin.com/fGvDM5NX
- CI logs:
[12:53:49 PM] [semantic-release] › ℹ Running semantic-release version 17.4.3
2022-01-11T15:53:49.371Z semantic-release:config load config from: /home/jenkins/workspace/NAC/nac-ui/.releaserc.json
2022-01-11T15:53:49.386Z semantic-release:config options values: {
branches: [
'master',
'next',
{ name: 'develop', prerelease: true },
{ name: 'beta', prerelease: true }
],
repositoryUrl: '*****',
tagFormat: 'v${version}',
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[ '@semantic-release/changelog', [Object] ],
'@semantic-release/npm',
[ '@semantic-release/git', [Object] ]
],
_: [],
debug: true,
'$0': '/home/jenkins/workspace/NAC/nac-ui/node_modules/.bin/semantic-release'
}
2022-01-11T15:53:49.538Z semantic-release:plugins options for @semantic-release/changelog/verifyConditions: { changelogFile: 'CHANGELOG.md' }
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/changelog"
2022-01-11T15:53:49.540Z semantic-release:plugins options for @semantic-release/npm/verifyConditions: {}
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
2022-01-11T15:53:49.540Z semantic-release:plugins options for @semantic-release/git/verifyConditions: {
assets: [ 'package.json', 'CHANGELOG.md' ],
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
}
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/git"
2022-01-11T15:53:49.540Z semantic-release:plugins options for @semantic-release/commit-analyzer/analyzeCommits: {}
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
2022-01-11T15:53:49.541Z semantic-release:plugins options for @semantic-release/release-notes-generator/generateNotes: {}
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
2022-01-11T15:53:49.541Z semantic-release:plugins options for @semantic-release/changelog/prepare: { changelogFile: 'CHANGELOG.md' }
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/changelog"
2022-01-11T15:53:49.541Z semantic-release:plugins options for @semantic-release/npm/prepare: {}
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
2022-01-11T15:53:49.542Z semantic-release:plugins options for @semantic-release/git/prepare: {
assets: [ 'package.json', 'CHANGELOG.md' ],
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
}
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/git"
2022-01-11T15:53:49.542Z semantic-release:plugins options for @semantic-release/npm/publish: {}
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
2022-01-11T15:53:49.542Z semantic-release:plugins options for @semantic-release/npm/addChannel: {}
[12:53:49 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
2022-01-11T15:53:49.565Z semantic-release:get-git-auth-url Verifying ssh auth by attempting to push to [email protected]:dasa_desenv/nac-ui.git
2022-01-11T15:53:59.089Z semantic-release:get-tags found tags for branch master: [ { gitTag: 'v0.1.1-0', version: '0.1.1-0', channels: [ null ] } ]
2022-01-11T15:53:59.095Z semantic-release:get-tags found tags for branch next: []
2022-01-11T15:53:59.104Z semantic-release:get-tags found tags for branch develop: []
2022-01-11T15:53:59.111Z semantic-release:get-tags found tags for branch beta: []
[12:53:59 PM] [semantic-release] › ℹ This test run was triggered on the branch origin/master, while semantic-release is configured to only publish from master, next, develop, beta, therefore a new version won’t be published.
Done in 10.13s.
mlozanno
On Jenkins if you are using the GIT plugin or Github plugin. In the pipeline configuration, you can add Additional Behaviors
for either Check out to matching local branch
or Check out to specific local branch
and that should remove origin
.
mlozanno
On Jenkins if you are using the GIT plugin or Github plugin. In the pipeline configuration, you can add
Additional Behaviors
for eitherCheck out to matching local branch
orCheck out to specific local branch
and that should removeorigin
.
Great, I was having the same problem and this fixed it. Thanks!
would someone familiar enough with jenkins to explain this clearly be willing send a PR to add this detail to the recipe in the docs, so that others running into similar issues could find this information more easily?
jenkins How to configure?
I set an environment variable GIT_LOCAL_BRANCH = 'master'
and that worked for me