-
-
Notifications
You must be signed in to change notification settings - Fork 371
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 #516
Conversation
} | ||
|
||
getPullRequestDiff = async () => { | ||
// TODO: possible? |
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.
Can't seem to find an endpoint to get a raw diff
, but there's a structured version in the REST API. Could use that but would require changing some common code.
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.
OK, I'm reasonably sure the two underlying features that rely on this are:
- Finding out the modified/created/deleted files
- Generating metadata for a specific file (e.g. maybe a JSON diff, or showing before after etc)
There may be two different APIs that could get that kind of information from?
Wow, first of all, awesome 👍 |
Might be about an hour or two before I can think properly about this |
No worries - I need to take a break so I'll pick this up again tomorrow. |
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.
Yep, this is definitely the right way to do this
href: string | ||
name?: string | ||
}[] | ||
} |
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.
nice
// This is `danger.bitbucket_server` | ||
|
||
/** The BitBucketServer metadata for your PR */ | ||
export interface BitBucketServerDSL extends BitBucketServerJSONDSL {} |
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.
if/once you start getting some helper functions in the bitbucket DSL, that's where this comes in handy.
source/dsl/BitBucketServerDSL.ts
Outdated
export interface JIRAIssue { | ||
key: string | ||
url: string | ||
} |
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.
This is cool
source/dsl/BitBucketServerDSL.ts
Outdated
locked: boolean | ||
author: BitBucketServerPRParticipant & { role: "AUTHOR" } | ||
reviewers: (BitBucketServerPRParticipant & { role: "REVIEWER" })[] | ||
participants: (BitBucketServerPRParticipant & { role: "PARTICPANT" })[] |
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.
Nice typing work
source/platforms/BitBucketServer.ts
Outdated
createComment = (comment: string) => this.api.postPRComment(comment) | ||
|
||
// In Danger RB we support a danger_id property, | ||
// this should be handled at some point |
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.
This is handled, I should remove the comment
yarn.lock
Outdated
@@ -1371,9 +1371,9 @@ cli-spinners@^0.1.2: | |||
version "0.1.2" | |||
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c" |
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.
ah, I bet this is me accepting greenkeeper PRs
danger-js/source/ci_source/providers/Travis.ts Lines 55 to 57 in 6f1371d
Noticed this in all the ci_sources. But it doesn't seem to be used? |
re:
Yeah, so only certain CI sources will support things like GitLab/BB/BBS - for example TeamCity supports GH/GitLab/BB/BBS in Ruby: code So you can verify that the CI hooks up to the platform, but TBH, it might not need it, considering that the ENV vars added must mean that someone knows it will work, so maybe the abstraction isn't needed? |
Re: the comment, tricky yeah. Another option is to do some funky markdown by adding line separators between the HTML content and the markdown <table>
<thead>
<tr>
<th width="5%"></th>
<th width="95%" data-danger-table="true">Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>:+1:</td>
<td>
some [markdown](/link)
</td>
</tr>
</tbody>
</table>
Which is the trick used in the gitlab markdown renderer for GitLab + BBS in Ruby |
It doesn't seem to support any HTML at all. :( |
Yeah, true that, I found the template: https://github.com/danger/danger/blob/132c5d1a415656bee49d451b861569a6a08cfc30/lib/danger/comment_generators/bitbucket_server.md.erb#L1-L20 |
(not sure what happened with that merge commit, will have to roll back) |
The above message is an integration test that should only sending its messages to STDOUT btw, if you're wondering wha could have triggered it |
0301946
to
15f7428
Compare
return diffs.map(diff => ({ | ||
from: diff.source && diff.source.toString, | ||
to: diff.destination && diff.destination.toString, | ||
chunks: diff.hunks.map(hunk => ({ |
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 have no idea what the difference between a hunk and a chunk is...
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.
All the pieces needed for a male model catalogue
I think all the functionality is done. I'll start writing tests tomorrow and look at documentation. |
Added tests. 🔬 |
@orta know what's up with this build? |
The TypeScript doesn't seem to compile, https://travis-ci.org/danger/danger-js/jobs/345868483#L593-L596
Which cascades through some of the next tests. |
Wow @azz, this is so much work 👍 |
I've got it green, and extended the DSL with some JSDocs |
Awesome, I'll try and find some time in the next few days to write docs and give it a test on a project at work. |
Cool cool, once you're happy with the docs in here I can go take it to the more gnarly getting started page |
Had a busy week at work and didn't get a chance to try it out! I'll try again early this coming week. |
OK @azz - I've gone and done a docs run, and prepared for it on the website too ( https://gitlab.com/danger-systems/danger.systems/merge_requests/168 ) Want to give me a lint for it all and say whether this is good to go? |
For some reason when installing from your branch I am not able to access danger command using yarn. |
It's probably not being compiled by TypeScript |
So how would I fix it? I am not JS dev, but really would like to adopt the JS version of danger with BBS support finally :) |
I'd wait TBH if you're not a JS dev, it shouldn't be too long |
👍 👍 👍 |
ok, let's try get this rolling |
@azz i found that API So Do you have this problem with your Bitbucket Server? I could not find any information or issues about this bug/behavior. |
Closes #515
Still a bunch of things to do but it is starting to take shape.
TODO:
getPullRequestDiff
- Not sure if there's a way to download the raw patch...