Skip to content

Commit 81fa788

Browse files
committed
handle incomplete tag lookups (PR 263161)
1 parent 799e311 commit 81fa788

7 files changed

+13
-2
lines changed

apis/github.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ func GithubHasTag(account, project, tag string) (bool, error) {
6262

6363
var ref GithubRef
6464
if err := json.Unmarshal(resp, &ref); err != nil {
65-
return false, fmt.Errorf("error unmarshalling: %v, resp: %v", err, string(resp))
65+
switch err := err.(type) {
66+
case *json.UnmarshalTypeError:
67+
// type mismatch during unmarshal, tag was incomplete and the API returned an array
68+
return false, nil
69+
default:
70+
return false, fmt.Errorf("error unmarshalling: %v, resp: %v", err, string(resp))
71+
}
6672
}
6773

6874
return true, nil

apis/github_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build online
12
// +build online
23

34
package apis

apis/gitlab_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build online
12
// +build online
23

34
package apis

parser/parser_e2e_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build e2e
12
// +build e2e
23

34
package parser

parser/parser_offline_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !online && !e2e
12
// +build !online,!e2e
23

34
package parser

parser/parser_online_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build online
12
// +build online
23

34
package parser

testdata/concourse_expected.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ GH_TUPLE= \
2121
cenkalti:backoff:v2.1.1:cenkalti_backoff/vendor/github.com/cenkalti/backoff \
2222
census-instrumentation:opencensus-go:v0.22.2:census_instrumentation_opencensus_go/vendor/go.opencensus.io \
2323
charlievieth:fs:7dc373669fa1:charlievieth_fs/vendor/github.com/charlievieth/fs \
24-
cloudfoundry-incubator:credhub-cli:e3951663d25c:cloudfoundry_incubator_credhub_cli/vendor/code.cloudfoundry.org/credhub-cli \
2524
cloudfoundry:clock:02e53af36e6c:cloudfoundry_clock/vendor/code.cloudfoundry.org/clock \
25+
cloudfoundry:credhub-cli:e3951663d25c:cloudfoundry_credhub_cli/vendor/code.cloudfoundry.org/credhub-cli \
2626
cloudfoundry:garden:62470dc86365:cloudfoundry_garden/vendor/code.cloudfoundry.org/garden \
2727
cloudfoundry:go-socks5:54f73bdb8a8e:cloudfoundry_go_socks5/vendor/github.com/cloudfoundry/go-socks5 \
2828
cloudfoundry:lager:v2.0.0:cloudfoundry_lager/vendor/code.cloudfoundry.org/lager \

0 commit comments

Comments
 (0)