Bug fixes and logging

This commit is contained in:
Ed
2018-12-16 23:02:46 -05:00
parent 74430d5d22
commit 130c7c1c06
3 changed files with 14 additions and 18 deletions

View File

@@ -79,6 +79,7 @@ func (g *gitlabClient) ListTags() ([]*gitlab.Tag, error) {
for { for {
tags, res, err := g.client.Tags.ListTags(g.repository, opt) tags, res, err := g.client.Tags.ListTags(g.repository, opt)
fmt.Printf("listing tags, page %d out of %d\n", opt.Page, res.TotalPages)
if err != nil { if err != nil {
return []*gitlab.Tag{}, err return []*gitlab.Tag{}, err
} }
@@ -112,6 +113,7 @@ func (g *gitlabClient) ListTagsUntil(tag_name string) ([]*gitlab.Tag, error) {
if err != nil { if err != nil {
return []*gitlab.Tag{}, err return []*gitlab.Tag{}, err
} }
fmt.Printf("listing tags until %s, page %d out of %d\n", tag_name, opt.Page, res.TotalPages)
if opt.Page >= res.TotalPages { if opt.Page >= res.TotalPages {
break break
@@ -136,6 +138,7 @@ func (g *gitlabClient) GetTag(tag_name string) (*gitlab.Tag, error) {
if err != nil { if err != nil {
return &gitlab.Tag{}, err return &gitlab.Tag{}, err
} }
fmt.Printf("getting tag %s", tag_name)
err = res.Body.Close() err = res.Body.Close()
if err != nil { if err != nil {

View File

@@ -128,10 +128,14 @@ func (c *InCommand) getAttachments(releaseBody string) ([]attachment, error) {
lines := strings.Split(releaseBody, "\n") lines := strings.Split(releaseBody, "\n")
for _, line := range lines { for _, line := range lines {
nameStart := strings.Index(line, "[") + 1 nameStart := strings.Index(line, "[")
nameEnd := strings.Index(line, "]") - 1 nameEnd := strings.Index(line, "]")
urlStart := strings.Index(line, "(") + 1 urlStart := strings.Index(line, "(")
urlEnd := strings.Index(line, ")") - 1 urlEnd := strings.Index(line, ")")
if nameStart == -1 || nameEnd == -1 || urlStart == -1 || urlEnd == -1 {
continue
}
attachments = append(attachments, attachment{ attachments = append(attachments, attachment{
Name: line[nameStart:nameEnd], Name: line[nameStart:nameEnd],

View File

@@ -1,19 +1,11 @@
package resource package resource
type Source struct { type Source struct {
Owner string `json:"owner"`
Repository string `json:"repository"` Repository string `json:"repository"`
// Deprecated; use Owner instead GitlabAPIURL string `json:"gitlab_api_url"`
User string `json:"user"` AccessToken string `json:"access_token"`
Insecure bool `json:"insecure"`
GitlabAPIURL string `json:"gitlab_api_url"`
GitlabUploadsURL string `json:"gitlab_uploads_url"`
AccessToken string `json:"access_token"`
Drafts bool `json:"drafts"`
PreRelease bool `json:"pre_release"`
Release bool `json:"release"`
Insecure bool `json:"insecure"`
TagFilter string `json:"tag_filter"` TagFilter string `json:"tag_filter"`
} }
@@ -25,19 +17,16 @@ type CheckRequest struct {
func NewCheckRequest() CheckRequest { func NewCheckRequest() CheckRequest {
res := CheckRequest{} res := CheckRequest{}
res.Source.Release = true
return res return res
} }
func NewOutRequest() OutRequest { func NewOutRequest() OutRequest {
res := OutRequest{} res := OutRequest{}
res.Source.Release = true
return res return res
} }
func NewInRequest() InRequest { func NewInRequest() InRequest {
res := InRequest{} res := InRequest{}
res.Source.Release = true
return res return res
} }