rancher/pipeline

Fail to acquire Projects from private Gitlab server

Closed this issue · 4 comments

报错信息如下

2017/12/27 上午12:02:56panic(0x9d1e60, 0xf0cb90)
2017/12/27 上午12:02:56	/usr/local/go/src/runtime/panic.go:489 +0x2cf
2017/12/27 上午12:02:56github.com/rancher/pipeline/scm.GitlabManager.toGitRepo(0xc42035c8a0, 0x13, 0xc42039f160, 0x7, 0xc420522000, 0x5e, 0x66, 0x5e, 0x0, 0xc420047500)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/scm/gitlab_manager.go:162 +0x1a6
2017/12/27 上午12:02:56github.com/rancher/pipeline/scm.GitlabManager.getGitlabRepos(0xc42035c8a0, 0x13, 0xc42039f160, 0x7, 0xc4202e8280, 0x40, 0x0, 0x0, 0x0, 0x0, ...)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/scm/gitlab_manager.go:151 +0x73f
2017/12/27 上午12:02:56github.com/rancher/pipeline/scm.GitlabManager.GetRepos(0xc42035c8a0, 0x13, 0xc42039f160, 0x7, 0xc420096180, 0xc420096240, 0xf25600, 0xc42035c8e0, 0x0, 0xc420096240)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/scm/gitlab_manager.go:63 +0x79
2017/12/27 上午12:02:56github.com/rancher/pipeline/scm.(*GitlabManager).GetRepos(0xc42035c8e0, 0xc420096180, 0xf25600, 0xc42035c8e0, 0x0, 0x0, 0x0)
2017/12/27 上午12:02:56	<autogenerated>:14 +0x72
2017/12/27 上午12:02:56github.com/rancher/pipeline/server/service.RefreshRepos(0xc4203fa6d4, 0x11, 0xc420128000, 0x0, 0x0, 0xc420038578, 0x4424f5)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/server/service/account_service.go:27 +0x9d
2017/12/27 上午12:02:56github.com/rancher/pipeline/server/service.GetCacheRepoList(0xc4203fa6d4, 0x11, 0xa7d72f, 0x2, 0xc42042a088, 0xc4200387a0, 0x4d73be)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/server/service/account_service.go:248 +0x325
2017/12/27 上午12:02:56github.com/rancher/pipeline/server.(*Server).GetCacheRepos(0xc42012a620, 0x7f12593e8878, 0xc4201705d0, 0xc42019c200, 0x2042a128, 0xc420038820)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/server/account_handler.go:126 +0xa4
2017/12/27 上午12:02:56github.com/rancher/pipeline/server.(*Server).GetCacheRepos-fm(0x7f12593e8878, 0xc4201705d0, 0xc42019c200, 0xc420038888, 0x7b4e93)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/server/router.go:63 +0x48
2017/12/27 上午12:02:56github.com/rancher/pipeline/server.HandleError.func1(0x7f12593e8878, 0xc4201705d0, 0xc42019c200)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/server/router.go:16 +0x5e
2017/12/27 上午12:02:56net/http.HandlerFunc.ServeHTTP(0xc4204dcea0, 0x7f12593e8878, 0xc4201705d0, 0xc42019c200)
2017/12/27 上午12:02:56	/usr/local/go/src/net/http/server.go:1942 +0x44
2017/12/27 上午12:02:56github.com/rancher/pipeline/vendor/github.com/rancher/go-rancher/api.ApiHandler.func1(0x7f12593e8878, 0xc4201705d0, 0xc42019c200)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/vendor/github.com/rancher/go-rancher/api/handler.go:20 +0x131
2017/12/27 上午12:02:56net/http.HandlerFunc.ServeHTTP(0xc4204c3820, 0x7f12593e8878, 0xc4201705d0, 0xc42019c200)
2017/12/27 上午12:02:56	/usr/local/go/src/net/http/server.go:1942 +0x44
2017/12/27 上午12:02:56github.com/rancher/pipeline/vendor/github.com/gorilla/context.ClearHandler.func1(0x7f12593e8878, 0xc4201705d0, 0xc42019c200)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/vendor/github.com/gorilla/context/context.go:141 +0x8b
2017/12/27 上午12:02:56net/http.HandlerFunc.ServeHTTP(0xc4204c3840, 0x7f12593e8878, 0xc4201705d0, 0xc42019c200)
2017/12/27 上午12:02:56	/usr/local/go/src/net/http/server.go:1942 +0x44
2017/12/27 上午12:02:56github.com/rancher/pipeline/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc42017c2d0, 0x7f12593e8878, 0xc4201705d0, 0xc42019c200)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/vendor/github.com/gorilla/mux/mux.go:103 +0x255
2017/12/27 上午12:02:56github.com/rancher/pipeline/vendor/github.com/gorilla/handlers.loggingHandler.ServeHTTP(0xf1b120, 0xc42000e018, 0xf1a260, 0xc42017c2d0, 0xf1fb20, 0xc420102380, 0xc42019c200)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/vendor/github.com/gorilla/handlers/handlers.go:69 +0x121
2017/12/27 上午12:02:56github.com/rancher/pipeline/vendor/github.com/gorilla/handlers.(*loggingHandler).ServeHTTP(0xc420402de0, 0xf1fb20, 0xc420102380, 0xc42019c200)
2017/12/27 上午12:02:56	<autogenerated>:8 +0x86
2017/12/27 上午12:02:56github.com/rancher/pipeline/vendor/github.com/gorilla/handlers.ProxyHeaders.func1(0xf1fb20, 0xc420102380, 0xc42019c200)
2017/12/27 上午12:02:56	/go/src/github.com/rancher/pipeline/vendor/github.com/gorilla/handlers/proxy_headers.go:54 +0xdb
2017/12/27 上午12:02:56net/http.HandlerFunc.ServeHTTP(0xc420402e00, 0xf1fb20, 0xc420102380, 0xc42019c200)
2017/12/27 上午12:02:56	/usr/local/go/src/net/http/server.go:1942 +0x44
2017/12/27 上午12:02:56net/http.serverHandler.ServeHTTP(0xc4200a42c0, 0xf1fb20, 0xc420102380, 0xc42019c200)
2017/12/27 上午12:02:56	/usr/local/go/src/net/http/server.go:2568 +0x92
2017/12/27 上午12:02:56net/http.(*conn).serve(0xc4200806e0, 0xf20420, 0xc4203fa600)
2017/12/27 上午12:02:56	/usr/local/go/src/net/http/server.go:1825 +0x612
2017/12/27 上午12:02:56created by net/http.(*Server).Serve
2017/12/27 上午12:02:56	/usr/local/go/src/net/http/server.go:2668 +0x2ce
2017/12/27 上午12:02:572017/12/26 16:02:57 http: panic serving 10.42.0.1:43182: runtime error: invalid memory address or nil pointer dereference
2017/12/27 上午12:02:57goroutine 174 [running]:
2017/12/27 上午12:02:57net/http.(*conn).serve.func1(0xc4201520a0)
2017/12/27 上午12:02:57	/usr/local/go/src/net/http/server.go:1721 +0xd0
2017/12/27 上午12:02:57panic(0x9d1e60, 0xf0cb90)
2017/12/27 上午12:02:57	/usr/local/go/src/runtime/panic.go:489 +0x2cf
2017/12/27 上午12:02:57github.com/rancher/pipeline/scm.GitlabManager.toGitRepo(0xc4202a1040, 0x13, 0xc4201c2f70, 0x7, 0xc420224000, 0x5e, 0x66, 0x5e, 0x0, 0xc42016ca80)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/scm/gitlab_manager.go:162 +0x1a6
2017/12/27 上午12:02:57github.com/rancher/pipeline/scm.GitlabManager.getGitlabRepos(0xc4202a1040, 0x13, 0xc4201c2f70, 0x7, 0xc4201d0c00, 0x40, 0x0, 0x0, 0x0, 0x0, ...)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/scm/gitlab_manager.go:151 +0x73f
2017/12/27 上午12:02:57github.com/rancher/pipeline/scm.GitlabManager.GetRepos(0xc4202a1040, 0x13, 0xc4201c2f70, 0x7, 0xc420096300, 0xc420096180, 0xf25600, 0xc4202a1080, 0x0, 0xc420096180)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/scm/gitlab_manager.go:63 +0x79
2017/12/27 上午12:02:57github.com/rancher/pipeline/scm.(*GitlabManager).GetRepos(0xc4202a1080, 0xc420096300, 0xf25600, 0xc4202a1080, 0x0, 0x0, 0x980c20)
2017/12/27 上午12:02:57	<autogenerated>:14 +0x72
2017/12/27 上午12:02:57github.com/rancher/pipeline/server/service.RefreshRepos(0xc42017c1a5, 0x11, 0xa7d72f, 0x2, 0xc4203bb3a8, 0xc42003b7a0, 0x4d73be)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/server/service/account_service.go:27 +0x9d
2017/12/27 上午12:02:57github.com/rancher/pipeline/server.(*Server).RefreshRepos(0xc42012a620, 0x7f12593e8878, 0xc4203a0150, 0xc4202b6100, 0x203bb448, 0xc42003b820)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/server/account_handler.go:106 +0xa4
2017/12/27 上午12:02:57github.com/rancher/pipeline/server.(*Server).RefreshRepos-fm(0x7f12593e8878, 0xc4203a0150, 0xc4202b6100, 0xc42003b888, 0x7b4e93)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/server/router.go:127 +0x48
2017/12/27 上午12:02:57github.com/rancher/pipeline/server.HandleError.func1(0x7f12593e8878, 0xc4203a0150, 0xc4202b6100)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/server/router.go:16 +0x5e
2017/12/27 上午12:02:57net/http.HandlerFunc.ServeHTTP(0xc420049ca0, 0x7f12593e8878, 0xc4203a0150, 0xc4202b6100)
2017/12/27 上午12:02:57	/usr/local/go/src/net/http/server.go:1942 +0x44
2017/12/27 上午12:02:57github.com/rancher/pipeline/vendor/github.com/rancher/go-rancher/api.ApiHandler.func1(0x7f12593e8878, 0xc4203a0150, 0xc4202b6100)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/vendor/github.com/rancher/go-rancher/api/handler.go:20 +0x131
2017/12/27 上午12:02:57net/http.HandlerFunc.ServeHTTP(0xc420402100, 0x7f12593e8878, 0xc4203a0150, 0xc4202b6100)
2017/12/27 上午12:02:57	/usr/local/go/src/net/http/server.go:1942 +0x44
2017/12/27 上午12:02:57github.com/rancher/pipeline/vendor/github.com/gorilla/context.ClearHandler.func1(0x7f12593e8878, 0xc4203a0150, 0xc4202b6100)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/vendor/github.com/gorilla/context/context.go:141 +0x8b
2017/12/27 上午12:02:57net/http.HandlerFunc.ServeHTTP(0xc420402120, 0x7f12593e8878, 0xc4203a0150, 0xc4202b6100)
2017/12/27 上午12:02:57	/usr/local/go/src/net/http/server.go:1942 +0x44
2017/12/27 上午12:02:57github.com/rancher/pipeline/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc42017c2d0, 0x7f12593e8878, 0xc4203a0150, 0xc4202b6100)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/vendor/github.com/gorilla/mux/mux.go:103 +0x255
2017/12/27 上午12:02:57github.com/rancher/pipeline/vendor/github.com/gorilla/handlers.loggingHandler.ServeHTTP(0xf1b120, 0xc42000e018, 0xf1a260, 0xc42017c2d0, 0xf1fb20, 0xc420102460, 0xc4202b6100)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/vendor/github.com/gorilla/handlers/handlers.go:69 +0x121
2017/12/27 上午12:02:57github.com/rancher/pipeline/vendor/github.com/gorilla/handlers.(*loggingHandler).ServeHTTP(0xc420402de0, 0xf1fb20, 0xc420102460, 0xc4202b6100)
2017/12/27 上午12:02:57	<autogenerated>:8 +0x86
2017/12/27 上午12:02:57github.com/rancher/pipeline/vendor/github.com/gorilla/handlers.ProxyHeaders.func1(0xf1fb20, 0xc420102460, 0xc4202b6100)
2017/12/27 上午12:02:57	/go/src/github.com/rancher/pipeline/vendor/github.com/gorilla/handlers/proxy_headers.go:54 +0xdb
2017/12/27 上午12:02:57net/http.HandlerFunc.ServeHTTP(0xc420402e00, 0xf1fb20, 0xc420102460, 0xc4202b6100)
2017/12/27 上午12:02:57	/usr/local/go/src/net/http/server.go:1942 +0x44
2017/12/27 上午12:02:57net/http.serverHandler.ServeHTTP(0xc4200a42c0, 0xf1fb20, 0xc420102460, 0xc4202b6100)
2017/12/27 上午12:02:57	/usr/local/go/src/net/http/server.go:2568 +0x92
2017/12/27 上午12:02:57net/http.(*conn).serve(0xc4201520a0, 0xf20420, 0xc4201d0080)
2017/12/27 上午12:02:57	/usr/local/go/src/net/http/server.go:1825 +0x612
2017/12/27 上午12:02:57created by net/http.(*Server).Serve
2017/12/27 上午12:02:57	/usr/local/go/src/net/http/server.go:2668 +0x2ce

Rancher 版本 v1.6.13
Gitlab 版本 10.2.2(企业私有)
情况:添加流水线,用户为Gitlab 授权用户,点击刷新代码仓库,列表返回为空
pipeline-server 日志报错,信息如上。

@gitlawr This is a bug,when the accout's repos who uses gitlab has no ProjectAccess Permission,it will panic.you can create a new accout,then create repos,it will be ok

@ssrshz Thanks for reporting, This is a bug that occurs when a user has permissions to a project via groups but he himself is not a project member.
Currently, a workaround is to add the user to project members via project settings->members->add to project. Then you can get the repo list by clicking the refresh button on source code step.
This will be fixed in the next release.

Move to rancher/rancher#10676 for tracking.

Fixed in v0.1.1