| 62 | } |
| 63 | |
| 64 | func 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 | |
| 97 | func dependencyVersion(name string, path string, dependencies []*dbg.Module) ComponentInfo { |
| 98 | ci := ComponentInfo{ |