Skip to content

Commit 5c0aefc

Browse files
committed
fix bug importing orb version
The bug hid errors occuring during an import of an orb version.
1 parent 1667a8d commit 5c0aefc

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

api/api.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ type OrbPublishResponse struct {
9999
}
100100
}
101101

102+
// The OrbImportVersionResponse type matches the data shape of the GQL response for
103+
// importing an orb version.
104+
type OrbImportVersionResponse struct {
105+
ImportOrbVersion struct {
106+
Orb Orb
107+
108+
Errors GQLErrorsCollection
109+
}
110+
}
111+
102112
// The OrbPromoteResponse type matches the data shape of the GQL response for
103113
// promoting an orb.
104114
type OrbPromoteResponse struct {
@@ -579,7 +589,7 @@ func OrbQuery(cl *graphql.Client, configPath string) (*ConfigResponse, error) {
579589

580590
// OrbImportVersion publishes a new version of an orb using the provided source and id.
581591
func OrbImportVersion(cl *graphql.Client, orbSrc string, orbID string, orbVersion string) (*Orb, error) {
582-
var response OrbPublishResponse
592+
var response OrbImportVersionResponse
583593

584594
query := `
585595
mutation($config: String!, $orbId: UUID!, $version: String!) {
@@ -608,11 +618,11 @@ func OrbImportVersion(cl *graphql.Client, orbSrc string, orbID string, orbVersio
608618
return nil, errors.Wrap(err, "unable to import orb version")
609619
}
610620

611-
if len(response.PublishOrb.Errors) > 0 {
612-
return nil, response.PublishOrb.Errors
621+
if len(response.ImportOrbVersion.Errors) > 0 {
622+
return nil, response.ImportOrbVersion.Errors
613623
}
614624

615-
return &response.PublishOrb.Orb, nil
625+
return &response.ImportOrbVersion.Orb, nil
616626
}
617627

618628
// OrbPublishByID publishes a new version of an orb by id

cmd/orb_import_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ The following orb versions already exist:
909909
}`
910910

911911
orbPublishResp := `{
912-
"publishOrb": {
912+
"importOrbVersion": {
913913
"errors": [{"message": "ERROR IN CONFIG FILE:\ntesterror"}]
914914
}
915915
}`

0 commit comments

Comments
 (0)