Documentation
¶
Index ¶
- Constants
- func GetMatchingSourceRegistries(manifests *[]schema.Manifest, gcrPayload *reg.GCRPubSubPayload) ([]registry.Context, error)
- func ParsePubSubMessage(body io.Reader) (*reg.GCRPubSubPayload, error)
- func ParsePubSubMessageBody(body []byte) (*reg.GCRPubSubPayload, error)
- func ValidatePayload(gcrPayload *reg.GCRPubSubPayload) error
- type GcrReadingFacility
- type PubSubMessage
- type PubSubMessageInner
- type ServerContext
Constants ¶
const ( // LogName is the auditing log name to use. This is the name that comes up // for "gcloud logging logs list". LogName = "cip-audit-log" )
Variables ¶
This section is empty.
Functions ¶
func GetMatchingSourceRegistries ¶
func GetMatchingSourceRegistries( manifests *[]schema.Manifest, gcrPayload *reg.GCRPubSubPayload, ) ([]registry.Context, error)
GetMatchingSourceRegistries gets the first source repository that matches the image information inside a GCRPubSubPayload.
func ParsePubSubMessage ¶
func ParsePubSubMessage(body io.Reader) (*reg.GCRPubSubPayload, error)
ParsePubSubMessage parses an HTTP request body into a reg.GCRPubSubPayload.
func ParsePubSubMessageBody ¶
func ParsePubSubMessageBody( body []byte, ) (*reg.GCRPubSubPayload, error)
ParsePubSubMessageBody parses the body of an HTTP request to be a GCRPubSubPayload.
func ValidatePayload ¶
func ValidatePayload(gcrPayload *reg.GCRPubSubPayload) error
ValidatePayload ensures that the payload is well-formed, per our business-logic needs.
Types ¶
type GcrReadingFacility ¶
type GcrReadingFacility struct { ReadRepo func(*reg.SyncContext, registry.Context) stream.Producer ReadManifestList func(*reg.SyncContext, *reg.GCRManifestListContext) stream.Producer }
GcrReadingFacility holds functions used to create streams for reading the repository and manifest list.
type PubSubMessage ¶
type PubSubMessage struct { Message PubSubMessageInner `json:"message"` Subscription string `json:"subscription"` }
PubSubMessage is the payload of a Pub/Sub event.
type PubSubMessageInner ¶
PubSubMessageInner is the inner struct that holds the actual Pub/Sub information.
type ServerContext ¶
type ServerContext struct { ID string RemoteManifestFacility remotemanifest.Facility ErrorReportingFacility report.ReportingFacility LoggingFacility logclient.LoggingFacility GcrReadingFacility GcrReadingFacility }
ServerContext holds all of the initialization data for the server to start up.
func InitRealServerContext ¶
func InitRealServerContext( gcpProjectID, repoURLStr, branch, path, uuid string, ) (*ServerContext, error)
InitRealServerContext creates a ServerContext with facilities that are meant for production use (going over the network to fetch actual official promoter manifests from GitHub, for example).
func (*ServerContext) Audit ¶
func (s *ServerContext) Audit(w http.ResponseWriter, r *http.Request)
Audit receives and processes a Pub/Sub push message. It has 3 parts: (1) parse the request body to understand the GCR state change, (2) update the Git repo of the promoter manifests, and (3) reconcile these two against each other.
func (*ServerContext) RunAuditor ¶
func (s *ServerContext) RunAuditor()
RunAuditor runs an HTTP server.