MCPcopy Create free account
hub / github.com/conforma/cli / ComputeInfo

Function ComputeInfo

internal/version/version.go:64–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62}
63
64func ComputeInfo() (*VersionInfo, error) {
65 buildInfo, ok := readBuildInfo()
66 if !ok {
67 return nil, errors.New("no build info available")
68 }
69
70 info := VersionInfo{}
71 info.Version = Version
72
73 for _, s := range buildInfo.Settings {
74 switch s.Key {
75 case "vcs.revision":
76 info.Commit = s.Value
77 case "vcs.time":
78 var err error
79 if info.ChangedOn, err = time.Parse(time.RFC3339, s.Value); err != nil {
80 return nil, err
81 }
82 }
83 }
84
85 info.Components = append(info.Components, dependencyVersion("ECC", "github.com/conforma/crds/api", buildInfo.Deps))
86 info.Components = append(info.Components, dependencyVersion("OPA", "github.com/open-policy-agent/opa", buildInfo.Deps))
87 info.Components = append(info.Components, dependencyVersion("Conftest", "github.com/open-policy-agent/conftest", buildInfo.Deps))
88 info.Components = append(info.Components, dependencyVersion("Cosign", "github.com/sigstore/cosign/v3", buildInfo.Deps))
89 info.Components = append(info.Components, dependencyVersion("Sigstore", "github.com/sigstore/sigstore", buildInfo.Deps))
90 info.Components = append(info.Components, dependencyVersion("Rekor", "github.com/sigstore/rekor", buildInfo.Deps))
91 info.Components = append(info.Components, dependencyVersion("Tekton Pipeline", "github.com/tektoncd/pipeline", buildInfo.Deps))
92 info.Components = append(info.Components, dependencyVersion("Kubernetes Client", "k8s.io/api", buildInfo.Deps))
93
94 return &info, nil
95}
96
97func dependencyVersion(name string, path string, dependencies []*dbg.Module) ComponentInfo {
98 ci := ComponentInfo{

Callers 4

NewReportFunction · 0.92
NewReportFunction · 0.92
initFunction · 0.92
TestComputeInfoFunction · 0.85

Calls 2

dependencyVersionFunction · 0.85
ParseMethod · 0.80

Tested by 1

TestComputeInfoFunction · 0.68