-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resource resolution on CD set (#865)
#### What this PR does / why we need it: Introduction resolution of relative resource references of the level of component descriptors. So far, this the resolution was only possible on the level of the complete component version access abstraction. This PR adds such a functionality on the level of plain component descriptors. Therefore, it provides a `ComponentVersionResolver` abstraction for component descriptors, with two implementations: a set of component descriptors and a compound resolver similar to the one for component version accesses. To align the element names in package `compdesc`, the `ComponentReference`ans been renamed to `Reference` (like `Resource` and `Source`). The old type has been deprecated. This functionality is required for the OCM controllers working an deep resources for a component version. To verify the digest of the retrieved content of a resource, a new function `signing.VerifyResourceDigest(cv, index, content)` is provided. it uses the digesting type described by the component version to recalculate the digest of the retrieved resource and verify it against the digest described by the component version.
- Loading branch information
1 parent
484ce45
commit 74e50a9
Showing
69 changed files
with
1,998 additions
and
137 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package compdesc | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/mandelsoft/goutils/generics" | ||
) | ||
|
||
type GenericComponentDescriptor ComponentDescriptor | ||
|
||
var ( | ||
_ json.Marshaler = (*GenericComponentDescriptor)(nil) | ||
_ json.Unmarshaler = (*GenericComponentDescriptor)(nil) | ||
) | ||
|
||
func (g GenericComponentDescriptor) MarshalJSON() ([]byte, error) { | ||
return Encode(generics.Pointer(ComponentDescriptor(g)), DefaultJSONCodec) | ||
} | ||
|
||
func (g *GenericComponentDescriptor) UnmarshalJSON(bytes []byte) error { | ||
cd, err := Decode(bytes, DefaultJSONCodec) | ||
if err != nil { | ||
return err | ||
} | ||
*g = *((*GenericComponentDescriptor)(cd)) | ||
return nil | ||
} | ||
|
||
func (g *GenericComponentDescriptor) Descriptor() *ComponentDescriptor { | ||
return (*ComponentDescriptor)(g) | ||
} |
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.