Git Product home page Git Product logo

Comments (36)

jlordiales avatar jlordiales commented on July 3, 2024 6

I'll take a stab at this using https://github.com/xanzy/go-gitlab

from jx.

rawkode avatar rawkode commented on July 3, 2024 2

@jstrachan Thanks. I'm going to start playing with this tonight. Happy to test anything you need, GitLab related. I'll let you know how I get on. Thanks again 👍

from jx.

vstars avatar vstars commented on July 3, 2024 2

I found that gitlab client does not invoke SetBaseURL method in pkg/gits/gitlab.go#L23, therefore the requests always go to the default base url https://gitlab.com/api/v4.

Adding c.SetBaseURL(server.URL) to NewGitlabProvider method makes requests goes to my own gitlab server.

func NewGitlabProvider(server *auth.AuthServer, user *auth.UserAuth) (GitProvider, error) {
	c := gitlab.NewClient(nil, user.ApiToken)
	c.SetBaseURL(server.URL) # add this
	return withGitlabClient(server, user, c)
}

But after that, new problem comes out when jx request to gitlab's Add project hook API. The project id in the URL is wrong, it has been URL-encoded twice. The correct value should be root%2Fdemo, but actually it is root%252Fdemo. See the request recorded by Charles:
wrong_url
I think this issue comes from wbrefvem/go-gitlab lib, because after I replace it with xanzy/go-gitlab in pkg/gits/gitlab.go#L10 then rebuild, everything works fine.
replace

gitlab "github.com/wbrefvem/go-gitlab"

with

gitlab "github.com/xanzy/go-gitlab"

For repo wbrefvem/go-gitlab, maybe it's time to sync the code from upsteam. :-)

from jx.

mulanshandi avatar mulanshandi commented on July 3, 2024 2

@erSitzt
I have solved this problem, refer to the following article:
https://docs.gitlab.com/ee/security/webhooks.html

from jx.

rawkode avatar rawkode commented on July 3, 2024

Is there anything that can be tested yet, or a fork for contributions? @jlordiales

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

@rawkode the gitlab code can be tested now - here's details of how to add new git servers etc: http://jenkins-x.io/developing/git/

So hopefully folks should be able to create new repos or import projects from gitlab etc.

Getting promotion to happen (submitting PRs, waiting for the PR checks to go green etc) tends to be the hardest bit of adding new git providers.

We may need to tweak the imported/generated projects in Jenkins more - so that they properly register the gitlab server in Jenkins and that the multi branch project in Jenkins (which handles triggering PR pipelines or updating PRs / commits with pipeline status) - are properly created for gitlab. Hopefully we can fix these pretty quickly though if someone fancies helping to test them

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

@rawkode many thanks! anything not working just add an issue and we can all dive in and try fix it :)

from jx.

CobraFlow avatar CobraFlow commented on July 3, 2024

I'm trying to use GitLab here on site.
Does it support the v4 api? I know that it didn't about a week ago...

Cheers

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

looks like the library supports v4 https://github.com/xanzy/go-gitlab yeah - (in fact it no longer supports v3)

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

we're using the latest release (0.9.0) from 22 days ago but could live life on the edge and try master if its needed ;) https://github.com/xanzy/go-gitlab/releases/tag/v0.9.0

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

@CobraFlow @rawkode I just spent a little bit of time trying out gitlab support - it was quite broken ;) Though once this PR is merged at least we can create/import projects #701 though there's an issue with the Jenkins / Multi branch project setup which I can hopefully fix later this week.

to try it out use:

  jx create git server gitlab https://gitlab.com/
   jx create git token -n gitlab myusername

from jx.

rawkode avatar rawkode commented on July 3, 2024

@jstrachan I assume this doesn't work with self-hosted GitLab's? 😃

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

Should work for any gitlab server really.

Though it looks like there is not yet a working gitlab branch source plugin for Jenkins :-f

from jx.

CobraFlow avatar CobraFlow commented on July 3, 2024

Been away for a while. I am taking things step by step.
I cannot create an environment with GitLab as repository provider.
The first issue is that the organisation list only includes the user. Choosing the user, the next issue is the url that it is using is https://gitlab.com/api/v4/projects/xxxxx is incorrect.

I can take a look at this if I could get my dev environment working! I have cloned the repo etc as per your hacking docs. I am using IntelliJ Idea and cannot get the vendor libraries to register. Also debugging using the stdin variation shows any breakpoints as invalid and does not break. Pointers?

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

@CobraFlow on IDEA stuff; make sure your project is set to be a Go project, set a SDK and ensure vendoring is enabled via Preferences -> Languages -> Go -> Vendoring though if you use 1.10 of go as your go SDK then you can't disable vendoring so it should work. There are general tips on developing and debugging here: https://github.com/jenkins-x/jx/blob/master/docs/contributing/hacking.md#debugging

from jx.

fgrelaud avatar fgrelaud commented on July 3, 2024

Hi,

is there a merge of planned ?

Same issue "default base url https://gitlab.com/api/v4" and not local url.

Thanks.
Regards

from jx.

aschepp avatar aschepp commented on July 3, 2024

I had also issues with creating hooks during jx install on gitlab.com, replacing wbrefvem with the xanzy version helped.

error: POST https://gitlab.com/api/v4/projects/aschepp/environment-xxxxxxx-staging/hooks: 404 {message: 404 Project Not Found}

from jx.

sneerin avatar sneerin commented on July 3, 2024

any updates on when it's going to be merged?

from jx.

dladi avatar dladi commented on July 3, 2024

Any updates on this, please?

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

the PR was merged and released yesterday - wanna test it out?

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

@dladi @sneerin wanna try it out and see how it works for you now? jx upgrade cli and jx upgrade platform should do the trick

from jx.

sekmarco avatar sekmarco commented on July 3, 2024

I created a gitlab ce inside the cluster and added it via jx create git gilab.
Tested it via jx import someproject:
jx created the repositories and pushed the git repo.
However then I got the error message:
No git server found

On jenkins the pipelines were there. However jenkins had not have the necessary credentials to login via git@git. Changing this to the http-url worked and the jobs started.

Ok I have an old gitlab ce version, I will try to update it tomorrow.

Update: With the new Gitlab Version 11.1.4, I got:
error: POST http://gitlab.IP.nip.io/api/v4/projects: 400 {message: {base: [14:Name resolution failure]}, {limit_reached: []}}

from jx.

sekmarco avatar sekmarco commented on July 3, 2024

It seemed to be, that the issue has to do with https://gitlab.com/gitlab-org/gitlab-ee/issues/6258

from jx.

2ZZ avatar 2ZZ commented on July 3, 2024

@jstrachan I tried to install jx v1.3.147 with Gitlab and hit an error relating to GitHub

Updating Jenkins with new external URL details http://jenkins.jx.1.1.1.1.nip.io
Creating default staging and production environments
Using git provider GitHub at https://github.com
error: failed to create staging environment: Server https://github.com has no user auths defined!

This was using the commands below

jx create git server gitlab https://gitlab.x.com/
jx install --provider=minikube --verbose=true

from jx.

jstrachan avatar jstrachan commented on July 3, 2024

@2ZZ could you try...

jx create git server gitlab https://gitlab.x.com/
jx create git token -n gitlab myusername
jx install --provider=minikube --verbose=true

as per https://jenkins-x.io/developing/git/#gitlab

from jx.

2ZZ avatar 2ZZ commented on July 3, 2024

Hi @jstrachan, not sure if I'm doing something wrong, the second command gives an error

jx create git token -n gitlab [email protected]
WARNING: The current user cannot query secrets in the namespace jx: Failed to get the development environment namespaces "jx" not found

This is the full output without that command, the API key is asked for during setup

jx install --provider=minikube --verbose=true
Context "minikube" modified.
set exposeController Config Domain 1.1.1.1.nip.io
Git configured for user: x x and email [email protected]
Tiller Deployment is running in namespace kube-system
nginx ingress controller already enabled
Lets set up a git username and API token to be able to perform CI/CD

? Which git provider? https://git.x.com/
? Do you wish to use [email protected] as the gitlab username for CI/CD pipelines: Yes
Cloning the Jenkins X cloud environments repo to /x/.jx/cloud-environments
? A local Jenkins X cloud environments repository already exists, recreate with latest? Yes
Cloning the Jenkins X cloud environments repo to /x/.jx/cloud-environments
Counting objects: 793, done.
Compressing objects: 100% (4/4), done.
Total 793 (delta 0), reused 1 (delta 0), pack-reused 789
Generated helm values /x/.jx/extraValues.yaml
Installing Jenkins X platform helm chart from: /x/.jx/cloud-environments/env-minikube
waiting for install to be ready, if this is the first time then it will take a while to download images
Jenkins X deployments ready in namespace jx


        ********************************************************

             NOTE: Your admin password is: xxxxxxxxxxxx

        ********************************************************

        Getting Jenkins API Token
using url http://jenkins.jx.1.1.1.1.nip.io/me/configure
unable to automatically find API token with chromedp using URL http://jenkins.jx.1.1.1.1.nip.io/me/configure
Please go to http://jenkins.jx.1.1.1.1.nip.io/me/configure and click Show API Token to get your API Token
Then COPY the token and enter in into the form below:

? API Token: ********************
Created user admin API Token for Jenkins server jenkins.jx.1.1.1.1.nip.io at http://jenkins.jx.1.1.1.1.nip.io
Updating Jenkins with new external URL details http://jenkins.jx.1.1.1.1.nip.io
Creating default staging and production environments
Using git provider GitHub at https://github.com
error: failed to create staging environment: Server https://github.com has no user auths defined!

from jx.

amarruedo avatar amarruedo commented on July 3, 2024

I am experiencing almost the same behaviour

$ jx get git
Name   Kind   URL
GitHub github https://github.com
gitlab gitlab http://gitlab.x.com

$ jx install --provider=kubernetes --on-premise
Git configured for user: x and email [email protected]
Tiller Deployment is running in namespace kube-system
existing ingress controller found, no need to install a new one
Waiting for external loadbalancer to be created and update the nginx-ingress-controller service in kube-system namespace
Using external IP: 1.1.1.1
You can now configure a wildcard DNS pointing to the new loadbalancer address 1.1.1.1

If you do not have a custom domain setup yet, Ingress rules will be set for magic dns nip.io.
Once you have a customer domain ready, you can update with the command jx upgrade ingress --cluster
If you don't have a wildcard DNS setup then setup a new CNAME and point it at: 1.1.1.1.nip.io then use the DNS domain in the next input...
? Domain test.x.com
nginx ingress controller installed and configured
Lets set up a git username and API token to be able to perform CI/CD

? Which git provider? http://gitlab.x.com
? gitlab user name: [email protected]
To be able to create a repository on gitlab we need an API Token
Please click this URL http://gitlab.x.com/profile/personal_access_tokens

Then COPY the token and enter in into the form below:

? API Token: ********************
Cloning the Jenkins X cloud environments repo to /Users/x/.jx/cloud-environments
Counting objects: 793, done.
Total 793 (delta 0), reused 0 (delta 0), pack-reused 793
Generated helm values /Users/x/.jx/extraValues.yaml
Installing Jenkins X platform helm chart from: /Users/x/.jx/cloud-environments/env-kubernetes
waiting for install to be ready, if this is the first time then it will take a while to download images
Jenkins X deployments ready in namespace jx

	
	********************************************************
	
	     NOTE: Your admin password is: slothjust
	
	********************************************************
	
	Getting Jenkins API Token
using url http://jenkins.jx.test.x.com/me/configure
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeRemoved) operation on node 15 (wait node): timeout waiting for node `15`
2018/08/09 16:18:46 error: could not perform (childNodeInserted) operation on node 15 (wait node): timeout waiting for node `15`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 18 (wait node): timeout waiting for node `18`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 16 (wait node): timeout waiting for node `16`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 18 (wait node): timeout waiting for node `18`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 18 (wait node): timeout waiting for node `18`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 18 (wait node): timeout waiting for node `18`
2018/08/09 16:18:46 error: could not perform (childNodeCountUpdated) operation on node 18 (wait node): timeout waiting for node `18`
logging in
Getting the API Token...
2018/08/09 16:18:57 error: could not perform (attributeModified) operation on node 83 (wait node): timeout waiting for node `83`
Found API Token
Created user admin API Token for Jenkins server jenkins.jx.test.x.com at http://jenkins.jx.test.x.com
Updating Jenkins with new external URL details http://jenkins.jx.test.x.com
Creating default staging and production environments
Using git provider GitHub at https://github.com
error: failed to create staging environment: Server https://github.com has no user auths defined!

$ jx create quickstart -l go
error: failed to load quickstarts: Could not create Git provider for host https://github.com as no user auths could be found

$ jx version
NAME               VERSION
jx                 1.3.160
jenkins x platform 0.0.2017
kubernetes cluster v1.9.6
kubectl            v1.11.1
helm client        v2.9.1+g20adb27
helm server        v2.9.1+g20adb27
git                git version 2.18.0

I'm running this on macOS.

from jx.

mulanshandi avatar mulanshandi commented on July 3, 2024

Is the following command necessary?
jx create git token -n gitlab myusername

I have tried to install jx on local kubemetes cluster and local gitlab server. And during the process that the system created the webhooks, an error occured:
error: POST https://gitlab.mydomain.com/V4/projects/5/hooks: 422 { Invalid url}

from jx.

erSitzt avatar erSitzt commented on July 3, 2024

Same here:
error: POST https://srv-git.mydomain.com/api/v4/projects/326/hooks: 422 {error: Invalid url given}

from jx.

erSitzt avatar erSitzt commented on July 3, 2024

@mulanshandi thanks, i will try that

from jx.

erSitzt avatar erSitzt commented on July 3, 2024

I think this works, because now i get 500 error from gitlab... but that seems to be a general issue with creating webhooks due to missing default values when not selecting the events for which the hook should be called...

from jx.

erSitzt avatar erSitzt commented on July 3, 2024

@mulanshandi
it's working, thanks again!

from jx.

jenkins-x-bot avatar jenkins-x-bot commented on July 3, 2024

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Provide feedback via https://jenkins-x.io/community.
/lifecycle stale

from jx.

jenkins-x-bot avatar jenkins-x-bot commented on July 3, 2024

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Provide feedback via https://jenkins-x.io/community.
/lifecycle rotten

from jx.

jenkins-x-bot avatar jenkins-x-bot commented on July 3, 2024

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Provide feedback via https://jenkins-x.io/community.
/close

from jx.

jenkins-x-bot avatar jenkins-x-bot commented on July 3, 2024

@jenkins-x-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Provide feedback via https://jenkins-x.io/community.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

from jx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.