MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / orgFromLocalState

Function orgFromLocalState

app/cli/cmd/attestation.go:93–105  ·  view source on GitHub ↗

orgFromLocalState reads the organization from the local attestation state file. Returns empty string on any error (file not found, parse error, etc.).

(customPath string)

Source from the content-addressed store, hash-verified

91// orgFromLocalState reads the organization from the local attestation state file.
92// Returns empty string on any error (file not found, parse error, etc.).
93func orgFromLocalState(customPath string) string {
94 raw, err := os.ReadFile(action.AttestationStatePath(customPath))
95 if err != nil {
96 return ""
97 }
98
99 state := &crafter.VersionedCraftingState{CraftingState: &v1.CraftingState{}}
100 if err := protojson.Unmarshal(raw, state); err != nil {
101 return ""
102 }
103
104 return state.GetAttestation().GetWorkflow().GetOrganization()
105}
106
107// extractAnnotations extracts the annotations from the flag and returns a map
108// the expected input format is key=value

Callers 2

TestOrgFromLocalStateFunction · 0.85
newAttestationCmdFunction · 0.85

Calls 4

AttestationStatePathFunction · 0.92
GetOrganizationMethod · 0.45
GetWorkflowMethod · 0.45
GetAttestationMethod · 0.45

Tested by 1

TestOrgFromLocalStateFunction · 0.68