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

update to v4 of gitlab api #80

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

ilushka85
Copy link
Contributor

No description provided.

@ghost
Copy link

ghost commented Jun 8, 2018

I have this stackstrace if I launch a scan of my gitlab projects :

[Fri Jun 08 13:43:45 UTC 2018] Updating actions...
[Fri Jun 08 13:43:45 UTC 2018] Consulting GitLab Projects
ERROR: [Fri Jun 08 13:43:45 UTC 2018] Could not fetch sources from navigator argelbargel.jenkins.plugins.gitlab_branch_source.GitLabSCMNavigator@49df211a
java.util.NoSuchElementException: unknown id: visible
	at argelbargel.jenkins.plugins.gitlab_branch_source.api.GitLabProjectSelector.byId(GitLabProjectSelector.java:19)
	at argelbargel.jenkins.plugins.gitlab_branch_source.ProjectQuery.<init>(ProjectQuery.java:31)
	at argelbargel.jenkins.plugins.gitlab_branch_source.GroupProjectQuery.<init>(GroupProjectQuery.java:15)
	at argelbargel.jenkins.plugins.gitlab_branch_source.ProjectQuery.create(ProjectQuery.java:20)
	at argelbargel.jenkins.plugins.gitlab_branch_source.SourceVisitor.visitSources(SourceVisitor.java:25)
	at argelbargel.jenkins.plugins.gitlab_branch_source.GitLabSCMNavigator.visitSources(GitLabSCMNavigator.java:133)
	at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:458)
	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:276)
	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
	at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:910)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)

@tnijboer
Copy link

@jbomaileva we have the same issue.

@alexkoepke
Copy link

Any updates or progress on this? How could one help move this along? I believe this could resolve #83.

@awilhelmer
Copy link

awilhelmer commented Jun 29, 2018

GitLab v11 removed the v3 API. I tried your PR, seems to be working only when i remove my old project (old settings on version 0.6.x of this plugin)
After recreating, the Jenkins project scan is working and all pipelines are created. But the webhooks arent registered in gitlab. Triggering the web hooks from old projects arent working too. However, testing the webhook from Gitlab returns HTTP 200, loggings are fine, but no builds are started.

Saving configuration triggers system webhook register which results in 403 forbidden responses

@@ -14,11 +14,11 @@
public static final String REVISION_HEAD = "HEAD";

public static GitLabSCMBranchHead createBranch(int projectId, String name, String hash) {
return createBranch(projectId, name, hash, false);
return createBranch(projectId, name+"t2", hash, false);
Copy link

@awilhelmer awilhelmer Jul 4, 2018

Choose a reason for hiding this comment

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

This causes problems if you change the name ...

@awilhelmer
Copy link

Okay found all problems and it's working now.

  1. Add org.gitlab.api.models.GitlabProject in ClassFilter
  2. In GitLabSCMHead.java remove the suffix "t2" and "t3" ...

Last problem is registering System WebHook in GitlabAPI. Method private GitlabSystemHook registerSystemHook(String url) throws IOException. It always throws WARNING: could not register hook https://***/gitlab-scm/notify/***: error accessing gitlab-api: {"message":"403 Forbidden"}, don't know why, i created this hook manually in gitlab via curl ...

curl --request POST --header "PRIVATE-TOKEN: ***" "https://***/api/v4/hooks?url=https://***/gitlab-scm/notify/***&enable_ssl_verification=false"

@alexkoepke
Copy link

Hey @awilhelmer,

Thanks for looking into this! When you said, "Okay found all problems and it's working now." Were you referring to this pull request?

Also, when you said, "Last problem is registering System WebHook in GitlabAPI." Is that a new issue or did you resolve it?

Sorry for the confusion.

Cheers,
Alex

@awilhelmer
Copy link

Hi @alexkoepke
yes iam referring to this pull request and the two changes i made (The two points) locally. The System Webhook is still a problem and i think it's a problem in the Gitlab API v4 dependency...

@ghost
Copy link

ghost commented Jul 6, 2018

So, the plugin is not fully compatible with gitlab 11 yet ?

@awilhelmer
Copy link

It works. The System Webhook is to detect new or deleted branches. The Push webhook for projects works fine.

@tnijboer
Copy link

tnijboer commented Jul 9, 2018

can you share your commits?

Ilya Beyrak added 2 commits July 11, 2018 13:04
# Conflicts:
#	pom.xml
#	src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/SourceHeads.java
#	src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/actions/GitLabSCMPublishAction.java
#	src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/hooks/HookHandler.java
@ilushka85
Copy link
Contributor Author

I resolved the issues noted in code that were part of my code for testing and also merged in the latest changed from master on here.

Additionally I began work on getting the note event trigger which is successfully working for merge requests but I cannot get it to trigger a job because it determines that the source code has not chnaged and will not trigger a build.

I would appreciate some help on this.

@paulerickson
Copy link
Contributor

Thanks for working on this, @ilushka85! Commenting out the note event stuff, I was able to build this (findbugs complained about the unused assignment) and get it working again after a Gitlab upgrade

@alexkoepke
Copy link

@paulerickson do you think your fixes will get this PR to a passing state? @Argelbargel are you able to confirm?

@paulerickson paulerickson mentioned this pull request Aug 13, 2018
@paulerickson
Copy link
Contributor

@alexkoepke okay, I opened #91 with Ilya's changes minus Notes, although I have not tested just yet. It would be great if someone else could test it too.

Push events still don't trigger for me, which I think is existing since 0.6.6.7

@paulerickson
Copy link
Contributor

I think this can be closed, since the v4 changes were incorporated in #91

@alexkoepke
Copy link

@paulerickson fantastic! Good to hear, I’ll test when I get the chance.

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.

5 participants