Skip to content
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

x/vgo: detect and support gitlab installs #24044

Closed
csos95 opened this issue Feb 22, 2018 · 7 comments

Comments

@csos95
Copy link

commented Feb 22, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10 darwin/amd64 vgo:2018-02-20.1

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/csos95/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/csos95/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/75/d65v47_x26gc33hnt__s2c940000gn/T/go-build164418382=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  1. created a module 'mylogger'
  2. pushed it to gitlab.csos95.com/csos95/mylogger and tagged it as v1.0.0
  3. created a module 'myproject' that requires gitlab.csos95.com/csos95/mylogger v1.0.0
  4. run vgo build

you can see the modules here:
https://gitlab.csos95.com/csos95/mylogger
https://gitlab.csos95.com/csos95/myproject

What did you expect to see?

vgo to find mylogger and build myproject without errors

What did you see instead?

vgo: finding gitlab.csos95.com/csos95/mylogger v1.0.0
vgo: gitlab.csos95.com/csos95/mylogger: unknown VCS, Repo: git, https://gitlab.csos95.com/csos95/mylogger.git
vgo: finding gitlab.csos95.com/csos95/mylogger v1.0.0
vgo: gitlab.csos95.com/csos95/mylogger: unknown VCS, Repo: git, https://gitlab.csos95.com/csos95/mylogger.git
vgo: unknown VCS, Repo: git, https://gitlab.csos95.com/csos95/mylogger.git

@gopherbot gopherbot added this to the vgo milestone Feb 22, 2018

@kardianos kardianos changed the title x/vgo: unknown VCS error x/vgo: detect and support gitlab installs Feb 22, 2018

@kardianos

This comment has been minimized.

Copy link
Contributor

commented Feb 22, 2018

It may be possible to detect and support gitlab installs. Or it may be better to merge into gitlab support for redirecting to the release archives.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Mar 30, 2018

I don't know anything about Gitlab. Does it have an identifying HTTP response header? Does it have an API to get at basic repo operations? We don't want to do a full git clone, we want to ask a few directed questions and then download go.mod and eventually a zip at a given commit.

@snowzach

This comment has been minimized.

Copy link

commented Apr 2, 2018

Gitlab has a decent API, unfortunately I've not figured out how to identify it as gitlab without probing a few endpoints. I'm certainly no expert with gitlab either so others may chime in.

You can view public stuff without auth.
Auth
https://docs.gitlab.com/ee/api/#authentication
Project API
https://docs.gitlab.com/ee/api/projects.html
Branches API
https://docs.gitlab.com/ee/api/branches.html
Commits API
https://docs.gitlab.com/ee/api/commits.html

The Repo can include a group name as well so URLS may be 3 levels deep: /group/repo/project

Go Get Info
`curl -k https://gitlab.domain.com/group/repo/project?go-get=1
<html><head><meta name="go-import" content="gitlab.domain.com/group/repo/project git https://gitlab.domain.com/group/repo/project.git" /></head></html>

Download Archive at commit hash
These all appear to be supported.

https://gitlab.domain.com/group/repo/project/repository/d60163b454afb9c62adf655bf03752daf49f5c04/archive.zip https://gitlab.domain.com/group/repo/project/repository/d60163b454afb9c62adf655bf03752daf49f5c04/archive.tar.gz https://gitlab.domain.com/group/repo/project/repository/d60163b454afb9c62adf655bf03752daf49f5c04/archive.tar.bz2 https://gitlab.domain.com/group/repo/project/repository/d60163b454afb9c62adf655bf03752daf49f5c04/archive.tar

@rsc

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2018

@snowzach thanks, what do you get from

 curl -I https://gitlab.domain.com/group/repo/project?go-get=1

?

@snowzach

This comment has been minimized.

Copy link

commented Apr 2, 2018

@rsc sadly, nothing that looks uniquely identifiable (at least to me)

$ curl -I https://gitlab.domain.com/group/repo/project?go-get=1
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 02 Apr 2018 17:48:33 GMT
Content-Type: text/html
Content-Length: 147
Connection: keep-alive
Cache-Control: max-age=0, private, must-revalidate
Etag: W/"fe165648a2aa44a0dafcd86f3f4b5649"
X-Request-Id: c95e0e8d-9557-41a5-b62a-4ebf8fc8fcd9
X-Runtime: 0.007819
Strict-Transport-Security: max-age=31536000
@snowzach

This comment has been minimized.

Copy link

commented Apr 2, 2018

While probably not ideal, if you fetch the repo without the go-get, the html has a number of instances of "gitlab" in it. It also has a cookie called _gitlab_session

$  curl -I https://gitlab.domain.com/group/repo/project
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 02 Apr 2018 18:00:50 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Cache-Control: max-age=0, private, must-revalidate
Etag: W/"688ac06f13fe32af397f0dd96cfccaec"
Set-Cookie: _gitlab_session=e30bbbcd6b2fe5edb6e9481de2782ea1; path=/; secure; HttpOnly
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Request-Id: 6639b09d-cb3a-4306-8583-c275eb7a7cff
X-Runtime: 0.151011
X-Ua-Compatible: IE=edge
X-Xss-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000
@rsc

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2018

Now that vgo supports plain git again, I can vgo get gitlab.csos95.com/csos95/mylogger.

@rsc rsc closed this Jun 6, 2018

@golang golang locked and limited conversation to collaborators Jun 6, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.