Skip to content

Commit

Permalink
Add original image field to base bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
glyn committed Apr 16, 2019
1 parent 1a73873 commit d54f80b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
13 changes: 7 additions & 6 deletions bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ type LocationRef struct {

// BaseImage contains fields shared across image types
type BaseImage struct {
ImageType string `json:"imageType" mapstructure:"imageType"`
Image string `json:"image" mapstructure:"image"`
Digest string `json:"digest,omitempty" mapstructure:"digest"`
Size uint64 `json:"size,omitempty" mapstructure:"size"`
Platform *ImagePlatform `json:"platform,omitempty" mapstructure:"platform"`
MediaType string `json:"mediaType,omitempty" mapstructure:"mediaType"`
ImageType string `json:"imageType" mapstructure:"imageType"`
Image string `json:"image" mapstructure:"image"`
OriginalImage string `json:"originalImage,omitempty" mapstructure:"originalImage"`
Digest string `json:"digest,omitempty" mapstructure:"digest"`
Size uint64 `json:"size,omitempty" mapstructure:"size"`
Platform *ImagePlatform `json:"platform,omitempty" mapstructure:"platform"`
MediaType string `json:"mediaType,omitempty" mapstructure:"mediaType"`
}

// ImagePlatform indicates what type of platform an image is built for
Expand Down
7 changes: 7 additions & 0 deletions bundle/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ func TestReadImageProperties(t *testing.T) {
if image1.Image != "urn:image1uri" {
t.Errorf("Expected Image 'urn:image1uri', got '%s'", image1.Image)
}
if image1.OriginalImage != "urn:image1originaluri" {
t.Errorf("Expected Image 'urn:image1originaluri', got '%s'", image1.OriginalImage)
}
image2 := bundle.Images["image2"]
if image2.OriginalImage != "" {
t.Errorf("Expected Image '', got '%s'", image2.OriginalImage)
}
}

func TestReadCredentialProperties(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions testdata/bundles/foo.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"image1":{
"description": "image1",
"image": "urn:image1uri",
"originalImage": "urn:image1originaluri",
"refs": [
{
"path": "image1path",
Expand Down

0 comments on commit d54f80b

Please sign in to comment.