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

Using DangerJS with GitLab/BitBucket #396

Open
k15a opened this Issue Oct 17, 2017 · 19 comments

Comments

Projects
None yet
7 participants
@k15a
Copy link
Contributor

k15a commented Oct 17, 2017

Hey,

is there a way how I can use DangerJS for GitLab with the GitLab CI. Otherwise, is it possible to add support for GitLab and GitLab CI and where could I start to implement it?

@orta

This comment has been minimized.

Copy link
Member

orta commented Oct 17, 2017

Can't use it for GitLab today.

However, I built Danger JS with the same abstractions used in Danger Ruby, which does. Though, I'd wait till #395 lands before starting though, it's a massive PR.

So the general TODO:

  • Add support for new ENV vars
  • Create a new object which conforms to Platform
  • getPlatformForEnv will need to figure out whether it's GH/GL project
  • Let a CI source determine if they can work with GitLab (I think there's already something in there )
  • Extend DangerJSONDSL / DangerDSL with a GitLab DSL
  • Cover this stuff in tests, as this repo runs on GitHub and it's possible we could accidentally break it
  • Note: The markdown rendering is different in Danger Ruby GitLab
  • Lots of other context in danger/danger#299
@orta

This comment has been minimized.

Copy link
Member

orta commented Oct 22, 2017

#395 is now merged 👍

@jchv

This comment has been minimized.

Copy link
Contributor

jchv commented Jan 3, 2018

Just FYI, I'm interested in working on this. Not 100% sure how far I'll get.

@k15a

This comment has been minimized.

Copy link
Contributor

k15a commented Jan 3, 2018

@jchv Nice that you want to give it a shot. Maybe some useful information I figured out:

  • GitLab doesn't have the concept of merge requests for now so you have to be a little bit hacky and figure out the corresponding merge request to a pipeline on your own. Take a look at the ruby integration and copy the logic from there.
  • Otherwise, the codebases are really close to each other so you can figure a lot of things out when you watch the Danger Ruby PR.
@jchv

This comment has been minimized.

Copy link
Contributor

jchv commented Jan 3, 2018

Yeah, luckily I have some of the background in mind already. I think working backwards to get the MR is fine; GitLab will probably eventually add CI events for MRs, at which point we can do this properly. Until then, there was a hack that someone mentioned in a Danger Ruby thread that filled the gap using build triggers such that Danger didn't have to be modified; that way, end users can at least make sure MRs always get hit until the CI itself supports MR events.

@LukeSheard

This comment has been minimized.

Copy link

LukeSheard commented Jan 3, 2018

Anyone got any idea how much effort it would be here to abstract it enough to support BitBucket server / hosted? Happy to lend some hours.

@orta

This comment has been minimized.

Copy link
Member

orta commented Jan 3, 2018

Abstraction wise it should be just as much work to support GitLab as it is for BitBucket - the original Danger Ruby PRs for that are danger/danger#481 and danger/danger#496

@orta

This comment has been minimized.

Copy link
Member

orta commented Jan 6, 2018

I've got some more work coming up which makes this easier as it decouples the git DSL from the github platform also

@orta

This comment has been minimized.

Copy link
Member

orta commented Jan 23, 2018

That work got merged two days ago: #473

@keplersj

This comment has been minimized.

Copy link
Member

keplersj commented Jan 23, 2018

I'm interested in pursuing this. Are there any blockers still before this can be done?

@orta

This comment has been minimized.

Copy link
Member

orta commented Jan 23, 2018

Nope, no blockers

@keplersj

This comment has been minimized.

Copy link
Member

keplersj commented Jan 23, 2018

So is the big thing to write the DSL for GitLab that gives access to the GitLab API?

@orta

This comment has been minimized.

Copy link
Member

orta commented Jan 23, 2018

Yeah, that's a good place to get started - I'd advise starting by finding a good npm module for the GitLab API then making something which conforms to Platform from that

@orta

This comment has been minimized.

Copy link
Member

orta commented Jan 23, 2018

DSL wise, I'd ideally like to feel like the GitHub DSL e.g. the minimum is:

danger.gitlab.mr = exactly the MR JSON from the API
danger.gitlab.utils = util funcs 
danger.gitlab.commits = commits from the GitLab API

After that you can expand it however makes sense

@peterjgrainger

This comment has been minimized.

Copy link

peterjgrainger commented Feb 2, 2018

@keplersj Can I give you a hand with this? It's kind of blocking us at the minute and can take over from where you left off if you don't have the time?

@keplersj

This comment has been minimized.

Copy link
Member

keplersj commented Feb 2, 2018

Please take it over. I never got to this and I'm about to leave the project I needed this for.

@peterjgrainger

This comment has been minimized.

Copy link

peterjgrainger commented Feb 2, 2018

OK, thanks @keplersj I'll have a look

@orta orta changed the title Use DangerJS for GitLab with GitLab CI Using DangerJS with GitLab/BitBucket Feb 2, 2018

@stigi stigi referenced this issue Apr 10, 2018

Open

WIP: GitLab #1

@kaoDev

This comment has been minimized.

Copy link

kaoDev commented May 18, 2018

hey @peterjgrainger did you have some time working on the gitlab integration?

@peterjgrainger

This comment has been minimized.

Copy link

peterjgrainger commented May 21, 2018

unfortunately not, something more pressing came up at work.

Happy for someone else to take it on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment