Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds hashed rekord type #501

Merged
merged 3 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/rekor-cli/app/pflag_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ func validateArtifactPFlags(uuidValid, indexValid bool) error {
}

// if neither --entry or --artifact were given, then a reference to a uuid or index is needed
if viper.GetString("entry") == "" && viper.GetString("artifact") == "" {
if viper.GetString("entry") == "" && viper.GetString("artifact") == "" && viper.GetString("artifact-hash") == "" {
if (uuidGiven && uuidValid) || (indexGiven && indexValid) {
return nil
}
return errors.New("either 'entry' or 'artifact' must be specified")
return errors.New("either 'entry' or 'artifact' or 'artifact-hash' must be specified")
}

return nil
Expand Down
1 change: 1 addition & 0 deletions cmd/rekor-cli/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (

// these imports are to call the packages' init methods
_ "github.com/sigstore/rekor/pkg/types/alpine/v0.0.1"
_ "github.com/sigstore/rekor/pkg/types/hashedrekord/v0.0.1"
_ "github.com/sigstore/rekor/pkg/types/helm/v0.0.1"
_ "github.com/sigstore/rekor/pkg/types/intoto/v0.0.1"
_ "github.com/sigstore/rekor/pkg/types/jar/v0.0.1"
Expand Down
19 changes: 11 additions & 8 deletions cmd/rekor-server/app/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
"github.com/sigstore/rekor/pkg/log"
"github.com/sigstore/rekor/pkg/types/alpine"
alpine_v001 "github.com/sigstore/rekor/pkg/types/alpine/v0.0.1"
hashedrekord "github.com/sigstore/rekor/pkg/types/hashedrekord"
hashedrekord_v001 "github.com/sigstore/rekor/pkg/types/hashedrekord/v0.0.1"
"github.com/sigstore/rekor/pkg/types/helm"
helm_v001 "github.com/sigstore/rekor/pkg/types/helm/v0.0.1"
"github.com/sigstore/rekor/pkg/types/intoto"
Expand Down Expand Up @@ -80,14 +82,15 @@ var serveCmd = &cobra.Command{

// these trigger loading of package and therefore init() methods to run
pluggableTypeMap := map[string]string{
rekord.KIND: rekord_v001.APIVERSION,
rpm.KIND: rpm_v001.APIVERSION,
jar.KIND: jar_v001.APIVERSION,
intoto.KIND: intoto_v001.APIVERSION,
rfc3161.KIND: rfc3161_v001.APIVERSION,
alpine.KIND: alpine_v001.APIVERSION,
helm.KIND: helm_v001.APIVERSION,
tuf.KIND: tuf_v001.APIVERSION,
rekord.KIND: rekord_v001.APIVERSION,
rpm.KIND: rpm_v001.APIVERSION,
jar.KIND: jar_v001.APIVERSION,
intoto.KIND: intoto_v001.APIVERSION,
rfc3161.KIND: rfc3161_v001.APIVERSION,
alpine.KIND: alpine_v001.APIVERSION,
helm.KIND: helm_v001.APIVERSION,
tuf.KIND: tuf_v001.APIVERSION,
hashedrekord.KIND: hashedrekord_v001.APIVERSION,
}

for k, v := range pluggableTypeMap {
Expand Down
17 changes: 17 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,23 @@ definitions:
- spec
additionalProperties: false

hashedrekord:
type: object
description: Hashed Rekord object
allOf:
- $ref: '#/definitions/ProposedEntry'
- properties:
apiVersion:
type: string
pattern: ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
spec:
type: object
$ref: 'pkg/types/hashedrekord/hashedrekord_schema.json'
required:
- apiVersion
- spec
additionalProperties: false

rpm:
type: object
description: RPM package
Expand Down
210 changes: 210 additions & 0 deletions pkg/generated/models/hashedrekord.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions pkg/generated/models/hashedrekord_schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading