-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add bitbucket server support #36
Conversation
@@ -66,10 +66,7 @@ class Bumper { | |||
*/ | |||
getOpenPrScope () { | |||
const vcs = this.vcs | |||
return utils.getSha(this.config, vcs) | |||
.then((sha) => { | |||
return vcs.getOpenPrForSha(sha) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to factor out both the getSha()
and the getOpenPrForSha()
methods because the CI environments we support both have access to the pull request number, which is a much more efficient way to get the PR from the API than by looking for all PRs that match a sha hash.
Changes Unknown when pulling 7b5e621 on job13er:add-bitbucket-server into * on ciena-blueplanet:master*. |
Changes Unknown when pulling 70aa4b7 on job13er:add-bitbucket-server into * on ciena-blueplanet:master*. |
Changes Unknown when pulling cc8bd7d on job13er:add-bitbucket-server into * on ciena-blueplanet:master*. |
Changes Unknown when pulling e6c0bb7 on job13er:add-bitbucket-server into * on ciena-blueplanet:master*. |
Changes Unknown when pulling 7071f42 on job13er:add-bitbucket-server into * on ciena-blueplanet:master*. |
This #minor# change adds bitbucket server API support.
Changes Unknown when pulling 02c80f7 on job13er:add-bitbucket-server into * on ciena-blueplanet:master*. |
}) | ||
.then(() => { | ||
return this.ci.push(this.vcs) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be reduced to:
return this._getMergedPrInfo()
.then((info) => {
return this._bumpVersion(info, 'package.json')
})
.then((info) => {
return this._prependChangelog(info, 'CHANGELOG.md')
})
.then(this._commitChanges.bind(this))
.then(this._createTag.bind(this))
.then(this.ci.push.bind(this, this.vcs))
and if you change the order of the arguments on _bumpVersion()
and _prependChangelog()
it could be reduced further to:
return this._getMergedPrInfo()
.then(this._bumpVersion.bind(this, 'package.json'))
.then(this._prependChangelog.bind(this, 'CHANGELOG.md'))
.then(this._commitChanges.bind(this))
.then(this._createTag.bind(this))
.then(this.ci.push.bind(this, this.vcs))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but to me, that's less readable.
This #minor# change adds bitbucket server API support.
Fixes #28
I must apologize to anyone who tries to look at the diff here. There was a major refactor that occurred during these changes, lots of logic was pulled from
lib/utils.js
intolib/bumper.js
as well as the introduction of aci
abstraction withtravis
andteamcity
implementations and moving some of the custom github/travis stuff fromlib/vcs/github.js
into the newly createdlib/ci/travis.js
.The end result is that we should now have a system in place where we have a common interface between the bumper, the CI system, and the VCS system, so we (or anyone else interested) should be able to add support for say, buildbot and github-enterprise, should they so desire.
CHANGELOG
You can now configure
pr-bumper
to work with something other than Travis CI and GitHub. The only other configuration that has been tested is TeamCity and Bitbucket Server. You can configurepr-bumper
to work with TeamCity and Bitbucket Server by placing a.pr-bumper.json
file in the root of your repository and filling in some information about your CI setup:ci.env.buildNumber
A string that provides the environment variable that holds the TeamCity build number on the agent that runs your build. One way to set that variable is with the following in your Build Step:
ci.env.pr
A string that provides the environment variable that holds the PR number of the pull request being built (empty when a not a PR build). One way to fill that variable is by including the following in your Build Step:
ci.gitUser
You can configure the
email
andname
that will be used by thegit
user for thecommit
that bumps the version inpackage.json
and prepends content toCHANGELOG.md
This setting can be used even if you're using thetravis
provider (see below)ci.provider
Here you configure what CI system you use, the only currently supported options are
travis
(the default), orteamcity
owner
The Bitbucket project where your repository resides
repo
The name of your Bitbucket repository
vcs.domain
The domain of your Bitbucket Server installation
vcs.env.username
andvcs.env.password
Strings that provide the environment variables which hold the credentials for a user with write permissions on the repository in question.
vcs.provider
Here you configure what VCS system you use, the only currently supported options are
github
(the default), orbitbucket-server