HealthCheck: show enterprise commit (#75242)

This commit is contained in:
Ezequiel Victorero
2023-09-22 08:17:10 -03:00
committed by GitHub
parent 3529b7413d
commit 4cfc834c08
10 changed files with 102 additions and 30 deletions
+16 -6
View File
@@ -10,9 +10,10 @@ import (
)
type Revision struct {
Timestamp int64
SHA256 string
Branch string
Timestamp int64
SHA256 string
EnterpriseCommit string
Branch string
}
func GrafanaTimestamp(ctx context.Context, dir string) (int64, error) {
@@ -42,14 +43,23 @@ func GrafanaRevision(ctx context.Context, grafanaDir string) (Revision, error) {
return Revision{}, err
}
enterpriseCommit, err := executil.OutputAt(ctx, grafanaDir, "git", "-C", "../grafana-enterprise", "rev-parse", "--short", "HEAD")
if err != nil {
enterpriseCommit, err = executil.OutputAt(ctx, grafanaDir, "git", "-C", "..", "rev-parse", "--short", "HEAD")
if err != nil {
return Revision{}, err
}
}
branch, err := executil.OutputAt(ctx, grafanaDir, "git", "rev-parse", "--abbrev-ref", "HEAD")
if err != nil {
return Revision{}, err
}
return Revision{
SHA256: sha,
Branch: branch,
Timestamp: stamp,
SHA256: sha,
EnterpriseCommit: enterpriseCommit,
Branch: branch,
Timestamp: stamp,
}, nil
}