diff --git a/check_command.go b/check_command.go index 9c4a86e..e6db930 100644 --- a/check_command.go +++ b/check_command.go @@ -80,7 +80,11 @@ func (c *CheckCommand) Run(request CheckRequest) ([]Version, error) { } if latestTag.Name == request.Version.Tag { - return []Version{}, nil + // GitHub release resource returns empty array: + // https://github.com/concourse/github-release-resource/blob/master/check_command.go#L87 + // but documentation says to return current item? + // https://concourse-ci.org/implementing-resources.html#section_resource-check + return []Version{Version{Tag: latestTag.Name}}, nil } upToLatest := false diff --git a/gitlab.go b/gitlab.go index 77771b9..7c06436 100644 --- a/gitlab.go +++ b/gitlab.go @@ -113,22 +113,27 @@ func (g *gitlabClient) ListTagsUntil(tag_name string) ([]*gitlab.Tag, error) { if err != nil { 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 { break } + foundTag := false for i, tag := range tags { if tag.Name == tag_name { - allTags = append(allTags, tags[:i]...) + allTags = append(allTags, tags[:i+1]...) + foundTag = true break } } + if foundTag { + break + } opt.Page = res.NextPage allTags = append(allTags, tags...) } + //fmt.Printf("%+v\n", allTags) return allTags, nil }