MCPcopy Create free account
hub / github.com/docker/buildx / platformFromReq

Function platformFromReq

policy/validate.go:503–517  ·  view source on GitHub ↗
(req *policysession.CheckPolicyRequest)

Source from the content-addressed store, hash-verified

501}
502
503func platformFromReq(req *policysession.CheckPolicyRequest) (*ocispecs.Platform, error) {
504 if req.Platform != nil {
505 platformStr := req.Platform.OS + "/" + req.Platform.Architecture
506 if req.Platform.Variant != "" {
507 platformStr += "/" + req.Platform.Variant
508 }
509 pl, err := platforms.Parse(platformStr)
510 if err != nil {
511 return nil, errors.Wrapf(err, "failed to parse platform")
512 }
513 pl = platforms.Normalize(pl)
514 return &pl, nil
515 }
516 return nil, nil
517}
518
519func sourceName(req *policysession.CheckPolicyRequest) string {
520 name := req.Source.Source.Identifier

Callers 2

CheckPolicyMethod · 0.85
sourceNameFunction · 0.85

Calls 1

NormalizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…