[sysadmin/projects-api] /: Expose lifecycle field on API

Julius Künzel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 4cae0450364224d08f85cc9b755c841a3644f701 by Julius Künzel.
Committed on 15/08/2026 at 00:00.
Pushed by sitter into branch 'master'.

Expose lifecycle field on API

It can be used by apps.kde.org to reliable show the state of an app. Right now states are not always shown correctly over there.

Related to websites/apps-kde-org#30

M  +1    -0    apis/project.go
M  +5    -2    apis/project_test.go
M  +2    -0    models/project.go

https://invent.kde.org/sysadmin/projects-api/-/commit/4cae0450364224d08f85cc9b755c841a3644f701

diff --git a/apis/project.go b/apis/project.go
index 66ca159..b1ab754 100644
--- a/apis/project.go
+++ b/apis/project.go
@@ -54,6 +54,7 @@ func ServeProjectResource(rg *gin.RouterGroup, service projectService) {
  *     "repo": "krita",
  *     "path": "calligra/krita",
  *     "identifier": "krita",
+ *     "lifecycle": "reviewed",
  *     "bug_database":"https://bugs.kde.org/buglist.cgi?product=krita&resolution=---",
  *     "bug_submit":"https://bugs.kde.org/enter_bug.cgi?product=krita"
  *   }
diff --git a/apis/project_test.go b/apis/project_test.go
index f553a3b..00b860e 100644
--- a/apis/project_test.go
+++ b/apis/project_test.go
@@ -25,6 +25,7 @@ func (s *ProjectService) Get(path string) (*models.Project, error) {
 		project.PathOnDisk = "calligra/krita"
 		project.Repo = "krita"
 		project.Identifier = "kritaid"
+		project.Lifecycle = "reviewed"
 		return &project, nil
 	}
 	if path == "calligra" {
@@ -48,6 +49,7 @@ func (s *ProjectService) Get(path string) (*models.Project, error) {
 		project.Repo = name
 		project.Identifier = name
 		project.Active = true
+		project.Lifecycle = "reviewed"
 		project.BugDatabase = "https://bugs.kde.org/db"
 		project.BugSubmit = "https://bugs.kde.org/submit"
 		return &project, nil
@@ -61,6 +63,7 @@ func (s *ProjectService) GetByIdentifier(id string) (*models.Project, error) {
 		project.PathOnDisk = "calligra/krita"
 		project.Repo = "krita"
 		project.Identifier = "kritaid"
+		project.Lifecycle = "reviewed"
 		return &project, nil
 	}
 	if id == "foo" {
@@ -108,8 +111,8 @@ func init() {
 }
 
 func TestProject(t *testing.T) {
-	kritaObj := `{"bug_database":"", "bug_submit":"", "i18n":{"component":"", "stable":"", "stableKF5":"", "trunk":"", "trunkKF5":""}, "identifier":"kritaid", "path":"calligra/krita", "repo":"krita"}`
-	mammothWithLtsObj := `{"i18n":{"component":"", "stable":"", "stableKF5":"other", "stableKF6":"kf6-stable", "stableLTSKF5":"older", "stableLTSKF6":"kf6-lts", "trunk":"", "trunkKF5":"master", "trunkKF6":"kf6-trunk"}, "identifier":"mammoth-with-lts", "path":"mammoth-with-lts", "repo":"mammoth-with-lts", "bug_database":"https://bugs.kde.org/db", "bug_submit":"https://bugs.kde.org/submit"}`
+	kritaObj := `{"bug_database":"", "bug_submit":"", "i18n":{"component":"", "stable":"", "stableKF5":"", "trunk":"", "trunkKF5":""}, "identifier":"kritaid", "lifecycle": "reviewed", "path":"calligra/krita", "repo":"krita"}`
+	mammothWithLtsObj := `{"i18n":{"component":"", "stable":"", "stableKF5":"other", "stableKF6":"kf6-stable", "stableLTSKF5":"older", "stableLTSKF6":"kf6-lts", "trunk":"", "trunkKF5":"master", "trunkKF6":"kf6-trunk"}, "identifier":"mammoth-with-lts", "path":"mammoth-with-lts", "repo":"mammoth-with-lts", "lifecycle": "reviewed", "bug_database":"https://bugs.kde.org/db", "bug_submit":"https://bugs.kde.org/submit"}`
 	runAPITests(t, []apiTestCase{
 		{"get a project", "GET", "/v1/project/calligra/krita", "", http.StatusOK, kritaObj},
 		{"get nil project", "GET", "/v1/project/calligra", "", http.StatusNotFound, ""},
diff --git a/models/project.go b/models/project.go
index 8a80467..0d9830d 100644
--- a/models/project.go
+++ b/models/project.go
@@ -26,6 +26,8 @@ type Project struct {
 	Active     bool   `yaml:"repoactive" json:"-"`          // do not marshal to json, we presently have no use case for it
 	Identifier string `yaml:"identifier" json:"identifier"` // also marshal'd via I18nData
 
+	Lifecycle string `yaml:"lifecycle" json:"lifecycle"`
+
 	Bugzilla BugzillaData `yaml:"bugzilla" json:"-"` // Currently there is no usecase of exporting the bugzilla data.
 
 	// Custom fields not found in input data. Calculated by us.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.