This repository has been archived by the owner on Jun 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #765 from eunomie/relocation-the-right-way
Relocation the right way
- Loading branch information
Showing
14 changed files
with
104 additions
and
125 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/deislabs/cnab-go/bundle" | ||
"github.com/docker/app/internal/relocated" | ||
"github.com/docker/cnab-to-oci/relocation" | ||
) | ||
|
||
const ( | ||
// bundlePath is where the CNAB runtime will put the actual Bundle definition | ||
bundlePath = "/cnab/bundle.json" | ||
// relocationMapPath is where the CNAB runtime will put the relocation map | ||
// See https://github.com/cnabio/cnab-spec/blob/master/103-bundle-runtime.md#image-relocation | ||
relocationMapPath = "/cnab/app/relocation-mapping.json" | ||
) | ||
|
||
func getBundle() (*bundle.Bundle, error) { | ||
return relocated.BundleJSON(bundlePath) | ||
} | ||
|
||
func getRelocationMap() (relocation.ImageRelocationMap, error) { | ||
return relocated.RelocationMapJSON(relocationMapPath) | ||
} | ||
|
||
func getRelocatedBundle() (*relocated.Bundle, error) { | ||
bndl, err := getBundle() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
relocationMap, err := getRelocationMap() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &relocated.Bundle{ | ||
Bundle: bndl, | ||
RelocationMap: relocationMap, | ||
}, 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
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
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
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
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.