-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This wraps the cnab-go bundle and adds support for custom extensions that porter supports. It will help us wean off of using the porter manifest at runtime, which is a huge problem because then our support for spec extensions only works when it was authored in Porter. More work is needed to fix this, but this is just a refactoring to get the data in the right place, i.e. when we do pass around a bundle, it's a bundle that knows how to deal with extensions. I am still saving a cnab bundle document so that if we change the structure of the wrapper it doesn't impact the stored document. Signed-off-by: Carolyn Van Slyck <[email protected]>
- Loading branch information
Showing
59 changed files
with
490 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,13 @@ | ||
package cnab | ||
|
||
import ( | ||
"get.porter.sh/porter/pkg/context" | ||
"github.com/cnabio/cnab-go/bundle" | ||
"github.com/cnabio/cnab-to-oci/relocation" | ||
"github.com/opencontainers/go-digest" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
type BundleReference struct { | ||
Reference OCIReference | ||
Digest digest.Digest | ||
Definition bundle.Bundle | ||
Definition ExtendedBundle | ||
RelocationMap relocation.ImageRelocationMap | ||
} | ||
|
||
// LoadBundle from the specified filepath. | ||
func LoadBundle(c *context.Context, bundleFile string) (bundle.Bundle, error) { | ||
bunD, err := c.FileSystem.ReadFile(bundleFile) | ||
if err != nil { | ||
return bundle.Bundle{}, errors.Wrapf(err, "cannot read bundle at %s", bundleFile) | ||
} | ||
|
||
bun, err := bundle.Unmarshal(bunD) | ||
if err != nil { | ||
return bundle.Bundle{}, errors.Wrapf(err, "cannot load bundle from\n%s at %s", string(bunD), bundleFile) | ||
} | ||
|
||
return *bun, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.