Skip to content

Commit

Permalink
Added git version info
Browse files Browse the repository at this point in the history
  • Loading branch information
akclace committed Nov 18, 2024
1 parent f3c92c3 commit dbeac5b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
4 changes: 3 additions & 1 deletion internal/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ func (m *Metadata) GetAllApps(includeInternal bool) ([]types.AppInfo, error) {
}
}

apps = append(apps, types.CreateAppInfo(types.AppId(id), metadata.Name, path, domain, isDev, types.AppId(mainApp), settings.AuthnType, sourceUrl, metadata.Spec))
apps = append(apps, types.CreateAppInfo(types.AppId(id), metadata.Name, path, domain, isDev,
types.AppId(mainApp), settings.AuthnType, sourceUrl, metadata.Spec,
metadata.VersionMetadata.Version, metadata.VersionMetadata.GitCommit, metadata.VersionMetadata.GitMessage))
}
if closeErr := rows.Close(); closeErr != nil {
return nil, fmt.Errorf("error closing rows: %w", closeErr)
Expand Down
3 changes: 3 additions & 0 deletions internal/server/clace_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ func (c *clacePlugin) ListApps(thread *starlark.Thread, builtin *starlark.Builti
}
v.SetKey(starlark.String("source_url"), starlark.String(app.SourceUrl))
v.SetKey(starlark.String("spec"), starlark.String(app.Spec))
v.SetKey(starlark.String("version"), starlark.MakeInt(app.Version))
v.SetKey(starlark.String("git_sha"), starlark.String(app.GitSha))
v.SetKey(starlark.String("git_message"), starlark.String(app.GitMessage))

ret.Append(&v)
}
Expand Down
38 changes: 23 additions & 15 deletions internal/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,16 @@ func (a AppPathDomain) String() string {
// AppInfo is the basic info for an app
type AppInfo struct {
AppPathDomain
Name string
Id AppId
IsDev bool
MainApp AppId
Auth AppAuthnType
SourceUrl string
Spec AppSpec
Name string
Id AppId
IsDev bool
MainApp AppId
Auth AppAuthnType
SourceUrl string
Spec AppSpec
Version int
GitSha string
GitMessage string
}

func CreateAppPathDomain(path, domain string) AppPathDomain {
Expand All @@ -246,19 +249,24 @@ func CreateAppPathDomain(path, domain string) AppPathDomain {
}
}

func CreateAppInfo(id AppId, name, path, domain string, isDev bool, mainApp AppId, auth AppAuthnType, sourceUrl string, spec AppSpec) AppInfo {
func CreateAppInfo(id AppId, name, path, domain string, isDev bool, mainApp AppId,
auth AppAuthnType, sourceUrl string, spec AppSpec,
version int, gitSha, gitMessage string) AppInfo {
return AppInfo{
AppPathDomain: AppPathDomain{
Path: path,
Domain: domain,
},
Name: name,
Id: id,
IsDev: isDev,
MainApp: mainApp,
Auth: auth,
SourceUrl: sourceUrl,
Spec: spec,
Name: name,
Id: id,
IsDev: isDev,
MainApp: mainApp,
Auth: auth,
SourceUrl: sourceUrl,
Spec: spec,
Version: version,
GitSha: gitSha,
GitMessage: gitMessage,
}
}

Expand Down

0 comments on commit dbeac5b

Please sign in to comment.