Skip to content

Commit

Permalink
handle incomplete tag lookups (PR 263161)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgk committed Apr 30, 2022
1 parent 799e311 commit 81fa788
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion apis/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ func GithubHasTag(account, project, tag string) (bool, error) {

var ref GithubRef
if err := json.Unmarshal(resp, &ref); err != nil {
return false, fmt.Errorf("error unmarshalling: %v, resp: %v", err, string(resp))
switch err := err.(type) {
case *json.UnmarshalTypeError:
// type mismatch during unmarshal, tag was incomplete and the API returned an array
return false, nil
default:
return false, fmt.Errorf("error unmarshalling: %v, resp: %v", err, string(resp))
}
}

return true, nil
Expand Down
1 change: 1 addition & 0 deletions apis/github_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build online
// +build online

package apis
Expand Down
1 change: 1 addition & 0 deletions apis/gitlab_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build online
// +build online

package apis
Expand Down
1 change: 1 addition & 0 deletions parser/parser_e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build e2e
// +build e2e

package parser
Expand Down
1 change: 1 addition & 0 deletions parser/parser_offline_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !online && !e2e
// +build !online,!e2e

package parser
Expand Down
1 change: 1 addition & 0 deletions parser/parser_online_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build online
// +build online

package parser
Expand Down
2 changes: 1 addition & 1 deletion testdata/concourse_expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ GH_TUPLE= \
cenkalti:backoff:v2.1.1:cenkalti_backoff/vendor/github.com/cenkalti/backoff \
census-instrumentation:opencensus-go:v0.22.2:census_instrumentation_opencensus_go/vendor/go.opencensus.io \
charlievieth:fs:7dc373669fa1:charlievieth_fs/vendor/github.com/charlievieth/fs \
cloudfoundry-incubator:credhub-cli:e3951663d25c:cloudfoundry_incubator_credhub_cli/vendor/code.cloudfoundry.org/credhub-cli \
cloudfoundry:clock:02e53af36e6c:cloudfoundry_clock/vendor/code.cloudfoundry.org/clock \
cloudfoundry:credhub-cli:e3951663d25c:cloudfoundry_credhub_cli/vendor/code.cloudfoundry.org/credhub-cli \
cloudfoundry:garden:62470dc86365:cloudfoundry_garden/vendor/code.cloudfoundry.org/garden \
cloudfoundry:go-socks5:54f73bdb8a8e:cloudfoundry_go_socks5/vendor/github.com/cloudfoundry/go-socks5 \
cloudfoundry:lager:v2.0.0:cloudfoundry_lager/vendor/code.cloudfoundry.org/lager \
Expand Down

0 comments on commit 81fa788

Please sign in to comment.