From c3871e7da99fc664c0fedf925008a4324e521414 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 27 Oct 2021 21:03:04 -0400 Subject: [PATCH] feat: add created-at time to apps:report output --- docs/deployment/application-management.md | 3 +++ plugins/apps/report.go | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/docs/deployment/application-management.md b/docs/deployment/application-management.md index 9536d32de..92e9cfa44 100644 --- a/docs/deployment/application-management.md +++ b/docs/deployment/application-management.md @@ -243,16 +243,19 @@ dokku apps:report ``` =====> node-js-app app information + App created at: 1635126111 App dir: /home/dokku/node-js-app App deploy source: git App deploy source metadata: cd7b8afccb202f222e7dc7b427553e71ba5ddafd App locked: false =====> python-sample app information + App created at: 1635126000 App dir: /home/dokku/python-sample App deploy source: App deploy source metadata: App locked: false =====> ruby-sample app information + App created at: 1635122462 App dir: /home/dokku/ruby-sample App deploy source: git App deploy source metadata: c60921ea2799ca108276414b95ea197f16798d51 diff --git a/plugins/apps/report.go b/plugins/apps/report.go index 78f406ad2..b81680167 100644 --- a/plugins/apps/report.go +++ b/plugins/apps/report.go @@ -1,6 +1,9 @@ package apps import ( + "fmt" + "os" + "github.com/dokku/dokku/plugins/common" ) @@ -11,6 +14,7 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { } flags := map[string]common.ReportFunc{ + "--app-created-at": reportCreatedAt, "--app-deploy-source": reportDeploySource, "--app-deploy-source-metadata": reportDeploySourceMetadata, "--app-dir": reportDir, @@ -28,6 +32,15 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { return common.ReportSingleApp("app", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter) } +func reportCreatedAt(appName string) string { + fi, err := os.Stat(common.AppRoot(appName)) + if err != nil { + return "" + } + + return fmt.Sprint(fi.ModTime().Unix()) +} + func reportDeploySource(appName string) string { return common.PropertyGet("apps", appName, "deploy-source") }