Skip to content

Commit 65db43e

Browse files
author
Arkady Emelyanov
committed
double checked api calls
1 parent acb83d7 commit 65db43e

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ ExecStart=/usr/bin/docker run --rm --name %n \
107107
-e "GITLAB_FILE_NAMESPACE=acme" \
108108
-e "GITLAB_REPO_FILE_EXTRA_LIST=composerList.json,npmList.json" \
109109
-p 8080:4000 \
110-
dalee/comrade-pavlik2:1.0.3
110+
dalee/comrade-pavlik2:1.0.5
111111
112112
[Install]
113113
WantedBy=multi-user.target
114114
```
115-
> Please check image version, stable version is >= 1.0.3
115+
> Please check image version, stable version is >= 1.0.5
116116
117117
### Project setup
118118

pkg/client/gitlab/client_base.go

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"net/url"
99
)
1010

11-
//
12-
//
11+
// @see https://gitlab.com/gitlab-org/gitlab-ce/blob/8-5-stable/doc/api/projects.md#list-projects
12+
// https://docs.gitlab.com/ee/api/projects.html#list-projects
1313
//
1414
func (c *Client) GetProjectList() ([]*Project, error) {
1515

@@ -32,12 +32,12 @@ func (c *Client) GetProjectList() ([]*Project, error) {
3232
return projectList, nil
3333
}
3434

35-
//
36-
//
35+
// @see https://gitlab.com/gitlab-org/gitlab-ce/blob/8-5-stable/doc/api/projects.md#get-single-project
36+
// @see https://docs.gitlab.com/ee/api/projects.html#get-single-project
3737
//
3838
func (c *Client) GetProjectById(projectId int) (*Project, error) {
39-
4039
endpoint := fmt.Sprintf("projects/%d", projectId)
40+
4141
pageList, err := c.executeAPIMethod(endpoint)
4242
if err != nil {
4343
return nil, err
@@ -55,19 +55,18 @@ func (c *Client) GetProjectById(projectId int) (*Project, error) {
5555
return result, nil
5656
}
5757

58-
//
59-
//
58+
// @see https://gitlab.com/gitlab-org/gitlab-ce/blob/8-5-stable/doc/api/tags.md#list-project-repository-tags
59+
// @see https://docs.gitlab.com/ee/api/tags.html#list-project-repository-tags
6060
//
6161
func (c *Client) GetTagList(project *Project) ([]*Tag, error) {
62-
6362
endpoint := fmt.Sprintf("projects/%d/repository/tags", project.ID)
63+
6464
pageList, err := c.executeAPIMethod(endpoint)
6565
if err != nil {
6666
return nil, err
6767
}
6868

6969
tagList := make([]*Tag, 0)
70-
7170
for _, body := range pageList {
7271
page := make([]*Tag, 0)
7372
if err := json.Unmarshal(body, &page); err != nil {
@@ -80,38 +79,35 @@ func (c *Client) GetTagList(project *Project) ([]*Tag, error) {
8079
return tagList, nil
8180
}
8281

83-
//
84-
//
82+
// @see https://gitlab.com/gitlab-org/gitlab-ce/blob/8-5-stable/doc/api/repositories.md#get-file-archive
83+
// @see https://docs.gitlab.com/ee/api/repositories.html#get-file-archive
8584
//
8685
func (c *Client) GetArchive(project *Project, ref string) ([]byte, error) {
87-
// v4 uses sha as parameter name
88-
// v3 uses ref as parameter name
89-
refParam := "ref"
90-
if c.HasV4Support {
91-
refParam = "sha"
92-
}
93-
9486
endpoint := fmt.Sprintf(
95-
"projects/%d/repository/archive.tar.gz?%s=%s",
87+
"projects/%d/repository/archive.tar.gz?sha=%s",
9688
project.ID,
97-
refParam,
9889
url.QueryEscape(ref),
9990
)
10091

10192
pageList, err := c.executeAPIMethod(endpoint)
10293
if err != nil {
10394
return nil, err
10495
}
105-
10696
if len(pageList) == 0 {
10797
return nil, errors.New("Archive operation failed")
10898
}
10999

110100
return pageList[0], nil
111101
}
112102

103+
// @see https://gitlab.com/gitlab-org/gitlab-ce/blob/8-5-stable/doc/api/repository_files.md#get-file-from-repository
104+
// for v3 file_path should be QueryString parameter.
113105
//
106+
// @see https://docs.gitlab.com/ee/api/repository_files.html#get-file-from-repository
107+
// for v4 file_path is not a parameter but part of URI. Should be encoded anyway.
108+
// update, right now this one doesn't seem's to work.
114109
//
110+
// KEEP EYE ON THIS METHOD, v4 right now doesn't work as expected.
115111
//
116112
func (c *Client) GetFile(project *Project, path, ref string) ([]byte, error) {
117113

0 commit comments

Comments
 (0)