Created
February 15, 2021 18:20
-
-
Save mrparkers/b50f61ef5e33f9ec59ad95a70f1aff78 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"fmt" | |
"github.com/grafeas/grafeas/proto/v1beta1/build_go_proto" | |
"github.com/grafeas/grafeas/proto/v1beta1/common_go_proto" | |
"github.com/grafeas/grafeas/proto/v1beta1/grafeas_go_proto" | |
"github.com/grafeas/grafeas/proto/v1beta1/provenance_go_proto" | |
"github.com/grafeas/grafeas/proto/v1beta1/source_go_proto" | |
) | |
// some generic webhook-based collector is responsible for producing this | |
func main() { | |
occurrence := &grafeas_go_proto.Occurrence{ | |
Name: "", // unique | |
Resource: &grafeas_go_proto.Resource{ | |
Uri: "git://github.com/rode/collector-harbor@123abcde", | |
}, | |
Kind: common_go_proto.NoteKind_BUILD, | |
CreateTime: nil, | |
UpdateTime: nil, | |
Details: &grafeas_go_proto.Occurrence_Build{ | |
Build: &build_go_proto.Details{ | |
Provenance: &provenance_go_proto.BuildProvenance{ | |
Id: "", | |
ProjectId: "", | |
Commands: []*provenance_go_proto.Command{ // do we really need this? | |
{ | |
Name: "", | |
Env: []string{ | |
}, | |
Args: []string{ | |
}, | |
Dir: "", | |
Id: "", | |
WaitFor: []string{ | |
}, | |
}, | |
}, | |
BuiltArtifacts: []*provenance_go_proto.Artifact{ | |
{ | |
Checksum: "123456", | |
Id: "harbor.prod.liatr.io/library/alpine@sha256:123456", | |
Names: []string{ | |
"harbor.prod.liatr.io/library/alpine:latest", | |
"harbor.prod.liatr.io/library/alpine:v1.2.3", | |
}, | |
}, | |
{ | |
Checksum: "123456", | |
Id: "harbor.dev.liatr.io/library/alpine@sha256:123456", | |
Names: []string{ | |
"harbor.dev.liatr.io/library/alpine:latest", | |
"harbor.dev.liatr.io/library/alpine:v1.2.3", | |
}, | |
}, | |
}, | |
CreateTime: nil, | |
StartTime: nil, | |
EndTime: nil, | |
Creator: "", // jenkins, or user who merged PR, or user who kicked off build | |
LogsUri: "", // link to jenkins build? | |
SourceProvenance: &provenance_go_proto.Source{ | |
ArtifactStorageSourceUri: "", | |
FileHashes: nil, | |
Context: &source_go_proto.SourceContext{ | |
Context: &source_go_proto.SourceContext_Git{ | |
Git: &source_go_proto.GitSourceContext{ | |
Url: "github.com/rode/collector-harbor", | |
RevisionId: "123abcde", | |
}, | |
}, | |
Labels: map[string]string{ | |
}, | |
}, | |
AdditionalContexts: nil, | |
}, | |
TriggerId: "", | |
BuildOptions: nil, | |
BuilderVersion: "", | |
}, | |
}, | |
}, | |
} | |
fmt.Print(occurrence) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment