Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Migrate to v4 API #91

Merged
merged 1 commit into from
Feb 11, 2019
Merged

Migrate to v4 API #91

merged 1 commit into from
Feb 11, 2019

Conversation

paulerickson
Copy link
Contributor

See #80 — I took Ilya's changeset, removed in-progress Note stuff, tidied whitespace and rebased on upstream/master

@paulerickson
Copy link
Contributor Author

@Argelbargel : this is working for me and I think @tuxx, so it would be super if you could take a look over when you can and see if is mergeworthy.

@imduffy15
Copy link

Would love to see this its necessary since the gitlab 11 release.

@imduffy15
Copy link

@paulerickson there looks to be issues with the private String projectUrl(GitLabProjectSelector selector, GitLabProjectVisibility visibility, String searchPattern) function within GitLabAPI.java.

It places in a /projects/[owned|starred|visible]/..... which is no longer valid in v4 it should be something like /projects?[owned=true|starred=true]

ref: https://docs.gitlab.com/ee/api/v3_to_v4.html and https://docs.gitlab.com/ee/api/projects.html

Project filters are no longer available as GET /projects/foo, but as GET /projects?foo=true instead !8962
GET /projects/visible & GET /projects/all are consolidated into GET /projects and can be used with or without authorization
GET /projects/owned moved to GET /projects?owned=true
GET /projects/starred moved to GET /projects?starred=true
GET /projects returns all projects visible to current user, even if the user is not a member !9674
To get projects the user is a member of, use GET /projects?membership=true

@alexsirbu
Copy link

Tested with Jenkins ver. 2.121.3. Had to literally add all classes in hudson.remoting.ClassFilter file for it to work (including some subclasses), but afterwards it started working.

@Sumit-Ahuja
Copy link

@imduffy15 @alexsirbu Is there a PR or a commit with your changes? The original commit by @paulerickson doesn't really work, possibly due to the issues that you two have mentioned, but I suspect there might be more things that need fixing after I do what you two have already mentioned.

@imduffy15
Copy link

@Sumit-Ahuja pushed mine to here https://github.com/imduffy15/gitlab-branch-source-plugin

@alexsirbu
Copy link

As I haven't really worked on this before, my solution of adding all the classes and some subclasses (the ones I saw in errors in various places) might not be the best solution for solving the issue (went with the temporary solution from here - https://jenkins.io/blog/2018/01/13/jep-200/). However, this is unrelated directly with this issue of moving to V4 as it's related to Jenkins version compatibility - and there are separate issues for it already.

@alexkoepke
Copy link

@Argelbargel Do you have an opinion regarding @alexsirbu's solution?

@Sumit-Ahuja
Copy link

@Sumit-Ahuja pushed mine to here https://github.com/imduffy15/gitlab-branch-source-plugin

I will try it out, thanks. Had a similar solution for the membership and owned things.

@ghost
Copy link

ghost commented Sep 20, 2018

Do you have the "Don't trigger WIP Merge Request" feature working ? The filter seems to not be called in my local dev environnment.

StringBuilder urlBuilder = new StringBuilder(GitlabProject.URL).append("?membership=true");
if (!VISIBLE.equals(selector)) {
urlBuilder.append("&").append(selector.id()).append("=true");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imduffy15 I pulled your changes and I think the reason I didn't have the issue you experienced is that I'm filtering on a group and maybe hitting the above projectUrl method and not this one. I'm assuming this block was in there for the same fix, so I replaced your two conditionals with this one for consistency. Does this look right to you?

@paulerickson
Copy link
Contributor Author

@jbomaileva I haven't tested that myself, since I like building my PRs, but maybe someone else can weigh in.

FWIW, I use this beauty when I want to be selective of WIP status:

// All PRs go to test
stage('Deploy PR to Test') {
  when { changeRequest() }
  steps {…}
}

// Only non-WIP PRs go to beta
stage('Deploy PR to Beta') {
  when { allOf {
    changeRequest()
    expression { env.gitlabMergeRequestTitle ==~ /^(?i)(?!\[?WIP).*$/ } // Skip Work-In-Process PRs 
  } } 
  steps {…}
}

@paulerickson
Copy link
Contributor Author

@Argelbargel any chance of merging this? I have been using this build in production since August without incident and folks are making changes against this now for lack of v4 stuff on master. Thanks!

@makarek
Copy link

makarek commented Nov 28, 2018

Is there any fork/brach where we can use option Auto-Register Webhook

@paulerickson
Copy link
Contributor Author

@makarek that's working fine for me with this branch

@makarek
Copy link

makarek commented Dec 4, 2018

@paulerickson
Cool I've build from your commit and everything is working so far. One question about webhook cuz currently plugin created it with SSL Verification Disabled, it there an easy way to change it ?

@paulerickson
Copy link
Contributor Author

@makarek I get the same. Sorry, I don't know how to change it.

@imduffy15
Copy link

@paulerickson @Argelbargel what is stopping this from being merged and released?

@Argelbargel
Copy link
Owner

Hi there, sorry for the long wait, but i've been quite busy with other things lately.
I've just released 0.7.7-dev which incorporates the changes made by @paulerickson

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants