From 8972bb95d0c2944923f7a5a4e079bf2d78ef0d8c Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Mon, 8 Apr 2024 09:48:59 +0530 Subject: [PATCH 01/34] added sql for relese feat --- scripts/sql/234_alter_resource_object_audit.down.sql | 2 ++ scripts/sql/234_alter_resource_object_audit.up.sql | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 scripts/sql/234_alter_resource_object_audit.down.sql create mode 100644 scripts/sql/234_alter_resource_object_audit.up.sql diff --git a/scripts/sql/234_alter_resource_object_audit.down.sql b/scripts/sql/234_alter_resource_object_audit.down.sql new file mode 100644 index 0000000000..41fa9ccaac --- /dev/null +++ b/scripts/sql/234_alter_resource_object_audit.down.sql @@ -0,0 +1,2 @@ +ALTER TABLE devtron_resource_object_audit + DROP COLUMN audit_operation_path; \ No newline at end of file diff --git a/scripts/sql/234_alter_resource_object_audit.up.sql b/scripts/sql/234_alter_resource_object_audit.up.sql new file mode 100644 index 0000000000..6d5af7b536 --- /dev/null +++ b/scripts/sql/234_alter_resource_object_audit.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE devtron_resource_object_audit + ADD COLUMN audit_operation_path text; \ No newline at end of file From 3ea0a29e777a829c1c6b491a59e54025eb628acb Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Tue, 9 Apr 2024 11:02:05 +0530 Subject: [PATCH 02/34] updated sql script no --- ...ct_audit.down.sql => 238_alter_resource_object_audit.down.sql} | 0 ...object_audit.up.sql => 238_alter_resource_object_audit.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts/sql/{234_alter_resource_object_audit.down.sql => 238_alter_resource_object_audit.down.sql} (100%) rename scripts/sql/{234_alter_resource_object_audit.up.sql => 238_alter_resource_object_audit.up.sql} (100%) diff --git a/scripts/sql/234_alter_resource_object_audit.down.sql b/scripts/sql/238_alter_resource_object_audit.down.sql similarity index 100% rename from scripts/sql/234_alter_resource_object_audit.down.sql rename to scripts/sql/238_alter_resource_object_audit.down.sql diff --git a/scripts/sql/234_alter_resource_object_audit.up.sql b/scripts/sql/238_alter_resource_object_audit.up.sql similarity index 100% rename from scripts/sql/234_alter_resource_object_audit.up.sql rename to scripts/sql/238_alter_resource_object_audit.up.sql From fe4211c4c681b9603619ee1a87ee06cad9e640c0 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Fri, 12 Apr 2024 14:48:01 +0530 Subject: [PATCH 03/34] renamed sql files --- ...audit.down.sql => 238_alter_resource_release_feature.down.sql} | 0 ...ect_audit.up.sql => 238_alter_resource_release_feature.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts/sql/{238_alter_resource_object_audit.down.sql => 238_alter_resource_release_feature.down.sql} (100%) rename scripts/sql/{238_alter_resource_object_audit.up.sql => 238_alter_resource_release_feature.up.sql} (100%) diff --git a/scripts/sql/238_alter_resource_object_audit.down.sql b/scripts/sql/238_alter_resource_release_feature.down.sql similarity index 100% rename from scripts/sql/238_alter_resource_object_audit.down.sql rename to scripts/sql/238_alter_resource_release_feature.down.sql diff --git a/scripts/sql/238_alter_resource_object_audit.up.sql b/scripts/sql/238_alter_resource_release_feature.up.sql similarity index 100% rename from scripts/sql/238_alter_resource_object_audit.up.sql rename to scripts/sql/238_alter_resource_release_feature.up.sql From ef9682e36afefc4eee9cd9c0c4dc9709964b2635 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Fri, 12 Apr 2024 15:24:40 +0530 Subject: [PATCH 04/34] updated schema for release & release track --- .../238_alter_resource_release_feature.up.sql | 217 +++++++++++++++++- 1 file changed, 216 insertions(+), 1 deletion(-) diff --git a/scripts/sql/238_alter_resource_release_feature.up.sql b/scripts/sql/238_alter_resource_release_feature.up.sql index 6d5af7b536..a53907272d 100644 --- a/scripts/sql/238_alter_resource_release_feature.up.sql +++ b/scripts/sql/238_alter_resource_release_feature.up.sql @@ -1,2 +1,217 @@ ALTER TABLE devtron_resource_object_audit - ADD COLUMN audit_operation_path text; \ No newline at end of file + ADD COLUMN audit_operation_path text; + + +INSERT INTO devtron_resource(kind, display_name, icon, parent_kind_id, deleted, created_on, created_by, updated_on, + updated_by) +VALUES ('release-track', 'Release track', '', 0, false, now(), 1, now(), 1), + ('release', 'Release', '', 0, false, now(), 1, now(), 1); + +INSERT INTO devtron_resource_schema(devtron_resource_id, version, schema, latest, created_on, created_by, updated_on, + updated_by) +VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1', +'{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Release track Schema", + "type": "object", + "properties": + { + "version": + { + "const": "release-track" + }, + "kind": + { + "type": "string", + "enum": ["alpha1"] + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "idType":{ + "type": "string", + "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", + "enum": ["resourceId", "oldObjectId"] + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + } + }, + "required": + [ + "id", + "idType" + ] + }, + "dependencies": + { + "type": "array" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] +}', + true, now(), 1, now(), 1), +((select id from devtron_resource where kind = 'release'), 'alpha1', +'{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Release Schema", + "type": "object", + "properties": + { + "version": + { + "const": "release" + }, + "kind": + { + "type": "string", + "enum": ["alpha1"] + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "idType":{ + "type": "string", + "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release we keep data as devtron resource only. To differ between nature of these two types of id values.", + "enum": ["resourceId", "oldObjectId"] + }, + "releaseVersion": + { + "type": "string", + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "note": + { + "type":"string" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + {} + }, + "required": + [ + "id", + "releaseVersion" + ] + }, + "status": + { + "type": "object", + "properties": + { + "config": + { + "type": "object", + "properties": { + "status": + { + "type":"string", + "enum": [ + "draft", + "readyForRelease", + "hold" + ] + }, + "lock": + { + "type": "boolean" + } + }, + "required": + [ + "status" + ] + }, + }, + "required": + [ + "config" + ] + }, + "taskMapping": + { + "type": "array" + }, + "dependencies": + { + "type": "array" + } + }, + "required": + [ + "version", + "kind", + "overview", + "status" + ] +}', true, now(), 1, now(), 1); \ No newline at end of file From 17017bba6c67083122fc2ab0f3a2116be20f6d6a Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Fri, 12 Apr 2024 15:39:40 +0530 Subject: [PATCH 05/34] fixes in schema --- .../238_alter_resource_release_feature.up.sql | 217 +++++++++++++++++- 1 file changed, 210 insertions(+), 7 deletions(-) diff --git a/scripts/sql/238_alter_resource_release_feature.up.sql b/scripts/sql/238_alter_resource_release_feature.up.sql index a53907272d..1e80364943 100644 --- a/scripts/sql/238_alter_resource_release_feature.up.sql +++ b/scripts/sql/238_alter_resource_release_feature.up.sql @@ -2,15 +2,93 @@ ALTER TABLE devtron_resource_object_audit ADD COLUMN audit_operation_path text; +ALTER TABLE devtron_resource_schema ALTER COLUMN version TYPE varchar(10); + INSERT INTO devtron_resource(kind, display_name, icon, parent_kind_id, deleted, created_on, created_by, updated_on, updated_by) VALUES ('release-track', 'Release track', '', 0, false, now(), 1, now(), 1), ('release', 'Release', '', 0, false, now(), 1, now(), 1); -INSERT INTO devtron_resource_schema(devtron_resource_id, version, schema, latest, created_on, created_by, updated_on, +INSERT INTO devtron_resource_schema(devtron_resource_id, version, schema, sample_schema, latest, created_on, created_by, updated_on, updated_by) VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1', -'{ + '{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Release track Schema", + "type": "object", + "properties": + { + "version": + { + "const": "release-track" + }, + "kind": + { + "type": "string", + "enum": ["alpha1"] + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "idType":{ + "type": "string", + "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", + "enum": ["resourceId", "oldObjectId"] + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + } + }, + "required": + [ + "id", + "idType" + ] + }, + "dependencies": + { + "type": "array" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] + }','{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Release track Schema", "type": "object", @@ -88,8 +166,133 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' ] }', true, now(), 1, now(), 1), -((select id from devtron_resource where kind = 'release'), 'alpha1', -'{ + ((select id from devtron_resource where kind = 'release'), 'alpha1', + '{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Release Schema", + "type": "object", + "properties": + { + "version": + { + "const": "release" + }, + "kind": + { + "type": "string", + "enum": ["alpha1"] + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "idType":{ + "type": "string", + "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release we keep data as devtron resource only. To differ between nature of these two types of id values.", + "enum": ["resourceId", "oldObjectId"] + }, + "releaseVersion": + { + "type": "string" + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "note": + { + "type":"string" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + {} + }, + "required": + [ + "id", + "releaseVersion" + ] + }, + "status": + { + "type": "object", + "properties": + { + "config": + { + "type": "object", + "properties": { + "status": + { + "type":"string", + "enum": [ + "draft", + "readyForRelease", + "hold" + ] + }, + "lock": + { + "type": "boolean" + } + }, + "required": + [ + "status" + ] + } + }, + "required": + [ + "config" + ] + }, + "taskMapping": + { + "type": "array" + }, + "dependencies": + { + "type": "array" + } + }, + "required": + [ + "version", + "kind", + "overview", + "status" + ] + }', '{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Release Schema", "type": "object", @@ -120,7 +323,7 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' }, "releaseVersion": { - "type": "string", + "type": "string" }, "name": { @@ -191,7 +394,7 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' [ "status" ] - }, + } }, "required": [ @@ -214,4 +417,4 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "overview", "status" ] -}', true, now(), 1, now(), 1); \ No newline at end of file +}', true, now(), 1, now(), 1); \ No newline at end of file From 30bc02111b907d72a502918ec106b5a4c42f22d8 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Fri, 12 Apr 2024 18:54:34 +0530 Subject: [PATCH 06/34] updated schema --- .../238_alter_resource_release_feature.up.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/sql/238_alter_resource_release_feature.up.sql b/scripts/sql/238_alter_resource_release_feature.up.sql index 1e80364943..8cb4eda561 100644 --- a/scripts/sql/238_alter_resource_release_feature.up.sql +++ b/scripts/sql/238_alter_resource_release_feature.up.sql @@ -18,11 +18,11 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "type": "object", "properties": { - "version": + "kind": { "const": "release-track" }, - "kind": + "version": { "type": "string", "enum": ["alpha1"] @@ -94,11 +94,11 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "type": "object", "properties": { - "version": + "kind": { "const": "release-track" }, - "kind": + "version": { "type": "string", "enum": ["alpha1"] @@ -173,11 +173,11 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "type": "object", "properties": { - "version": + "kind": { "const": "release" }, - "kind": + "version": { "type": "string", "enum": ["alpha1"] @@ -298,11 +298,11 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "type": "object", "properties": { - "version": + "kind": { "const": "release" }, - "kind": + "version": { "type": "string", "enum": ["alpha1"] From 1343a74c35a2d1d0bba7807b5ff5cc553fc15bda Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Fri, 12 Apr 2024 19:12:49 +0530 Subject: [PATCH 07/34] made changes in old schemas --- .../238_alter_resource_release_feature.up.sql | 811 +++++++++++++++++- 1 file changed, 810 insertions(+), 1 deletion(-) diff --git a/scripts/sql/238_alter_resource_release_feature.up.sql b/scripts/sql/238_alter_resource_release_feature.up.sql index 8cb4eda561..400d14fa2c 100644 --- a/scripts/sql/238_alter_resource_release_feature.up.sql +++ b/scripts/sql/238_alter_resource_release_feature.up.sql @@ -417,4 +417,813 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "overview", "status" ] -}', true, now(), 1, now(), 1); \ No newline at end of file +}', true, now(), 1, now(), 1); + + +update devtron_resource_schema +set schema='{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Cluster Schema", + "type": "object", + "properties": + { + "kind": + { + "const": "cluster" + }, + "version": + { + "type": "string", + "enum": ["v1"] + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "idType":{ + "type": "string", + "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", + "enum": ["resourceId", "oldObjectId"] + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + { + "type": "object", + "properties": + { + "Contacts": + { + "type": "object", + "properties": + { + "Owner": + { + "type": "object", + "refType": "#/references/users" + }, + "On pager duty": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "Team": + { + "type": "string", + "enum": + [ + "Growth team", + "Support team", + "Platform team", + "Operations team" + ] + }, + "3rd party contacts": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "string" + } + } + }, + "required": + [ + "Owner" + ] + }, + "Networking & Others": + { + "type": "object", + "properties": + { + "Cluster type": + { + "type": "string", + "enum": + [ + "Production", + "Non production" + ] + }, + "Exposed to": + { + "type": "string", + "enum": + [ + "Public", + "Private" + ] + }, + "VPC peered": + { + "type": "array", + "items": + { + "type": "string" + } + }, + "Documentation": + { + "type": "string", + "format": "uri" + } + } + }, + "Backup": + { + "type": "object", + "properties": + { + "Backup strategy": + { + "type": "string", + "enum": + [ + "Full backup", + "Incremental", + "Snapshot" + ] + }, + "Backup retention policy (days)": + { + "type": "integer" + } + } + } + }, + "required": + [ + "Contacts" + ] + } + }, + "required": + [ + "id", + "metadata" + ] + }, + "actions": + { + "type": "array" + }, + "dependencies": + { + "type": "array" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] +}' +where devtron_resource_id = (select id from devtron_resource where kind = 'cluster') + and version = 'v1'; + +update devtron_resource_schema +set schema='{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Job Schema", + "type": "object", + "properties": + { + "kind": + { + "const": "job" + }, + "version": + { + "type": "string", + "enum": ["v1"] + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "idType":{ + "type": "string", + "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", + "enum": ["resourceId", "oldObjectId"] + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + { + "type": "object", + "properties": + { + "Contacts": + { + "type": "object", + "properties": + { + "Owner": + { + "type": "object", + "refType": "#/references/users" + }, + "POCs": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "Team": + { + "type": "string", + "enum": + [ + "Growth team", + "Support team", + "Platform team", + "Operations team" + ] + }, + "Access manager": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } + } + }, + "required": + [ + "Owner" + ] + }, + "About job": + { + "type": "object", + "properties": + { + "Type of job": + { + "type": "string", + "enum": + [ + "Deployment", + "Migration", + "Backup", + "Others" + ] + }, + "For environment": + { + "type": "string", + "enum": + [ + "Production", + "Dev", + "Staging", + "QA", + "UAT" + ] + }, + "Documentation": + { + "type": "string", + "format": "uri" + } + } + }, + "Operational schedule": + { + "type": "object", + "properties": + { + "Preferred run": + { + "type": "string" + }, + "Maintenance time": + { + "type": "string" + } + } + } + }, + "required": + [ + "Contacts" + ] + } + }, + "required": + [ + "id", + "metadata" + ] + }, + "actions": + { + "type": "array" + }, + "dependencies": + { + "type": "array" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] +}' +where devtron_resource_id = (select id from devtron_resource where kind = 'job') + and version = 'v1'; + +update devtron_resource_schema +set schema='{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Devtron Application Schema", + "type": "object", + "properties": + { + "kind": + { + "const": "application/devtron-application" + }, + "version": + { + "type": "string", + "enum": ["v1"] + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "idType":{ + "type": "string", + "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", + "enum": ["resourceId", "oldObjectId"] + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + { + "type": "object", + "properties": + { + "Owners & Pager Duty": + { + "type": "object", + "properties": + { + "Code owners": + { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "On pager duty": + { + "type": "object", + "refType": "#/references/users" + } + }, + "required": + [ + "Code owners" + ] + }, + "Service details": + { + "type": "object", + "properties": + { + "Framework": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "string", + "enum": + [ + "Django", + "Ruby on Rails", + "Laravel", + "Angular", + "React", + "jQuery", + "ASP.NET Core", + "Bootstrap" + ] + } + }, + "Language": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "string", + "enum": + [ + "Java", + "Python", + "PHP", + "Go", + "Ruby", + "Node" + ] + } + }, + "Communication method": + { + "type": "string", + "enum": + [ + "GraphQL", + "gRPC", + "Message Queue", + "NATS", + "REST API", + "WebSocket" + ] + }, + "Internet facing": + { + "type": "boolean" + } + } + }, + "Documentation": + { + "type": "object", + "properties": + { + "Service Documentation": + { + "type": "string", + "format": "uri" + }, + "API Contract": + { + "type": "string", + "format": "uri" + }, + "Runbook": + { + "type": "string", + "format": "uri" + } + } + } + }, + "required": + [ + "Owners & Pager Duty" + ] + } + }, + "required": + [ + "id", + "metadata" + ] + }, + "actions": + { + "type": "array" + }, + "dependencies": + { + "type": "array" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] +}' +where devtron_resource_id = (select id from devtron_resource where kind = 'devtron-application') + and version = 'v1'; + +update devtron_resource_schema +set schema='{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Helm Application Schema", + "type": "object", + "properties": + { + "kind": + { + "const": "application/helm-application" + }, + "version": + { + "type": "string", + "enum": ["v1"] + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "idType":{ + "type": "string", + "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", + "enum": ["resourceId", "oldObjectId"] + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + { + "type": "object", + "properties": + { + "Owners & Pager Duty": + { + "type": "object", + "properties": + { + "Code owners": + { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "On pager duty": + { + "type": "object", + "refType": "#/references/users" + } + }, + "required": + [ + "Code owners" + ] + }, + "Service details": + { + "type": "object", + "properties": + { + "Framework": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "string", + "enum": + [ + "Django", + "Ruby on Rails", + "Laravel", + "Angular", + "React", + "jQuery", + "ASP.NET Core", + "Bootstrap" + ] + } + }, + "Language": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "string", + "enum": + [ + "Java", + "Python", + "PHP", + "Go", + "Ruby", + "Node" + ] + } + }, + "Communication method": + { + "type": "string", + "enum": + [ + "GraphQL", + "gRPC", + "Message Queue", + "NATS", + "REST API", + "WebSocket" + ] + }, + "Internet facing": + { + "type": "boolean" + } + } + }, + "Documentation": + { + "type": "object", + "properties": + { + "Service Documentation": + { + "type": "string", + "format": "uri" + }, + "API Contract": + { + "type": "string", + "format": "uri" + }, + "Runbook": + { + "type": "string", + "format": "uri" + } + } + } + }, + "required": + [ + "Owners & Pager Duty" + ] + } + }, + "required": + [ + "id", + "metadata" + ] + }, + "actions": + { + "type": "array" + }, + "dependencies": + { + "type": "array" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] +}' +where devtron_resource_id = (select id from devtron_resource where kind = 'helm-application') + and version = 'v1'; \ No newline at end of file From d888ab4a01e3ccca707844e025fade5d0a27c79a Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Fri, 12 Apr 2024 22:14:56 +0530 Subject: [PATCH 08/34] enum correction --- .../238_alter_resource_release_feature.up.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/sql/238_alter_resource_release_feature.up.sql b/scripts/sql/238_alter_resource_release_feature.up.sql index 400d14fa2c..ebb11a3978 100644 --- a/scripts/sql/238_alter_resource_release_feature.up.sql +++ b/scripts/sql/238_alter_resource_release_feature.up.sql @@ -39,7 +39,7 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "idType":{ "type": "string", "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceId", "oldObjectId"] + "enum": ["resourceObjectId", "oldObjectId"] }, "name": { @@ -115,7 +115,7 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "idType":{ "type": "string", "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceId", "oldObjectId"] + "enum": ["resourceObjectId", "oldObjectId"] }, "name": { @@ -194,7 +194,7 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "idType":{ "type": "string", "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceId", "oldObjectId"] + "enum": ["resourceObjectId", "oldObjectId"] }, "releaseVersion": { @@ -319,7 +319,7 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "idType":{ "type": "string", "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceId", "oldObjectId"] + "enum": ["resourceObjectId", "oldObjectId"] }, "releaseVersion": { @@ -448,7 +448,7 @@ set schema='{ "idType":{ "type": "string", "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceId", "oldObjectId"] + "enum": ["resourceObjectId", "oldObjectId"] }, "name": { @@ -649,7 +649,7 @@ set schema='{ "idType":{ "type": "string", "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceId", "oldObjectId"] + "enum": ["resourceObjectId", "oldObjectId"] }, "name": { @@ -842,7 +842,7 @@ set schema='{ "idType":{ "type": "string", "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceId", "oldObjectId"] + "enum": ["resourceObjectId", "oldObjectId"] }, "name": { @@ -1049,7 +1049,7 @@ set schema='{ "idType":{ "type": "string", "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release track we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceId", "oldObjectId"] + "enum": ["resourceObjectId", "oldObjectId"] }, "name": { From f3bff097ea513988f09a92fb42268e4182b37de3 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Mon, 15 Apr 2024 14:55:43 +0530 Subject: [PATCH 09/34] minor change in script --- scripts/sql/238_alter_resource_release_feature.down.sql | 3 +++ scripts/sql/238_alter_resource_release_feature.up.sql | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scripts/sql/238_alter_resource_release_feature.down.sql b/scripts/sql/238_alter_resource_release_feature.down.sql index 41fa9ccaac..7a364f737e 100644 --- a/scripts/sql/238_alter_resource_release_feature.down.sql +++ b/scripts/sql/238_alter_resource_release_feature.down.sql @@ -1,2 +1,5 @@ +ALTER TABLE devtron_resource_object + DROP COLUMN identifier; + ALTER TABLE devtron_resource_object_audit DROP COLUMN audit_operation_path; \ No newline at end of file diff --git a/scripts/sql/238_alter_resource_release_feature.up.sql b/scripts/sql/238_alter_resource_release_feature.up.sql index ebb11a3978..1e3bd24ee7 100644 --- a/scripts/sql/238_alter_resource_release_feature.up.sql +++ b/scripts/sql/238_alter_resource_release_feature.up.sql @@ -1,3 +1,6 @@ +ALTER TABLE devtron_resource_object + ADD COLUMN identifier text; + ALTER TABLE devtron_resource_object_audit ADD COLUMN audit_operation_path text; From 3b2b30c2cdfba43e2243ed99538c8772fad795e5 Mon Sep 17 00:00:00 2001 From: Shivam-nagar23 Date: Mon, 15 Apr 2024 18:36:01 +0530 Subject: [PATCH 10/34] sql script update --- scripts/sql/238_alter_resource_release_feature.up.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/sql/238_alter_resource_release_feature.up.sql b/scripts/sql/238_alter_resource_release_feature.up.sql index 1e3bd24ee7..11c1b1b2b9 100644 --- a/scripts/sql/238_alter_resource_release_feature.up.sql +++ b/scripts/sql/238_alter_resource_release_feature.up.sql @@ -1,8 +1,8 @@ -ALTER TABLE devtron_resource_object - ADD COLUMN identifier text; +ALTER TABLE "public"."devtron_resource_object" + ADD COLUMN IF NOT EXISTS identifier text; ALTER TABLE devtron_resource_object_audit - ADD COLUMN audit_operation_path text; + ADD COLUMN IF NOT EXISTS audit_operation_path text[]; ALTER TABLE devtron_resource_schema ALTER COLUMN version TYPE varchar(10); From c6d3188c66d73034c77e1ee2cc715768c97388c8 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Mon, 15 Apr 2024 19:23:28 +0530 Subject: [PATCH 11/34] updated script --- scripts/sql/238_alter_resource_release_feature.up.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/sql/238_alter_resource_release_feature.up.sql b/scripts/sql/238_alter_resource_release_feature.up.sql index 11c1b1b2b9..47309107d8 100644 --- a/scripts/sql/238_alter_resource_release_feature.up.sql +++ b/scripts/sql/238_alter_resource_release_feature.up.sql @@ -7,10 +7,10 @@ ALTER TABLE devtron_resource_object_audit ALTER TABLE devtron_resource_schema ALTER COLUMN version TYPE varchar(10); -INSERT INTO devtron_resource(kind, display_name, icon, parent_kind_id, deleted, created_on, created_by, updated_on, +INSERT INTO devtron_resource(kind, display_name, icon,is_exposed, parent_kind_id, deleted, created_on, created_by, updated_on, updated_by) -VALUES ('release-track', 'Release track', '', 0, false, now(), 1, now(), 1), - ('release', 'Release', '', 0, false, now(), 1, now(), 1); +VALUES ('release-track', 'Release track', '',false, 0, false, now(), 1, now(), 1), + ('release', 'Release', '',false, 0, false, now(), 1, now(), 1); INSERT INTO devtron_resource_schema(devtron_resource_id, version, schema, sample_schema, latest, created_on, created_by, updated_on, updated_by) From 8eb794330b59e7cffa3bdbb1814aa91d63964d16 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Wed, 24 Apr 2024 12:48:52 +0530 Subject: [PATCH 12/34] updated sql script no --- ...ature.down.sql => 239_alter_resource_release_feature.down.sql} | 0 ...e_feature.up.sql => 239_alter_resource_release_feature.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts/sql/{238_alter_resource_release_feature.down.sql => 239_alter_resource_release_feature.down.sql} (100%) rename scripts/sql/{238_alter_resource_release_feature.up.sql => 239_alter_resource_release_feature.up.sql} (100%) diff --git a/scripts/sql/238_alter_resource_release_feature.down.sql b/scripts/sql/239_alter_resource_release_feature.down.sql similarity index 100% rename from scripts/sql/238_alter_resource_release_feature.down.sql rename to scripts/sql/239_alter_resource_release_feature.down.sql diff --git a/scripts/sql/238_alter_resource_release_feature.up.sql b/scripts/sql/239_alter_resource_release_feature.up.sql similarity index 100% rename from scripts/sql/238_alter_resource_release_feature.up.sql rename to scripts/sql/239_alter_resource_release_feature.up.sql From e72247291b771f37cb09756508bcfd9af1d21655 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Wed, 1 May 2024 21:34:54 +0530 Subject: [PATCH 13/34] exposed release resource --- scripts/sql/239_alter_resource_release_feature.up.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sql/239_alter_resource_release_feature.up.sql b/scripts/sql/239_alter_resource_release_feature.up.sql index 47309107d8..8f6d308cfa 100644 --- a/scripts/sql/239_alter_resource_release_feature.up.sql +++ b/scripts/sql/239_alter_resource_release_feature.up.sql @@ -10,7 +10,7 @@ ALTER TABLE devtron_resource_schema ALTER COLUMN version TYPE varchar(10); INSERT INTO devtron_resource(kind, display_name, icon,is_exposed, parent_kind_id, deleted, created_on, created_by, updated_on, updated_by) VALUES ('release-track', 'Release track', '',false, 0, false, now(), 1, now(), 1), - ('release', 'Release', '',false, 0, false, now(), 1, now(), 1); + ('release', 'Release', '',true, 0, false, now(), 1, now(), 1); INSERT INTO devtron_resource_schema(devtron_resource_id, version, schema, sample_schema, latest, created_on, created_by, updated_on, updated_by) From eb033dd0652bfde78dea3b51c9a103e33b66a8ca Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Wed, 1 May 2024 21:35:56 +0530 Subject: [PATCH 14/34] updated sql script no --- ...ature.down.sql => 241_alter_resource_release_feature.down.sql} | 0 ...e_feature.up.sql => 241_alter_resource_release_feature.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts/sql/{239_alter_resource_release_feature.down.sql => 241_alter_resource_release_feature.down.sql} (100%) rename scripts/sql/{239_alter_resource_release_feature.up.sql => 241_alter_resource_release_feature.up.sql} (100%) diff --git a/scripts/sql/239_alter_resource_release_feature.down.sql b/scripts/sql/241_alter_resource_release_feature.down.sql similarity index 100% rename from scripts/sql/239_alter_resource_release_feature.down.sql rename to scripts/sql/241_alter_resource_release_feature.down.sql diff --git a/scripts/sql/239_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql similarity index 100% rename from scripts/sql/239_alter_resource_release_feature.up.sql rename to scripts/sql/241_alter_resource_release_feature.up.sql From 6b702e7f991cea848c2f76d2cd33eb882d27f51a Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Wed, 1 May 2024 21:59:28 +0530 Subject: [PATCH 15/34] updated release catalog data --- .../241_alter_resource_release_feature.up.sql | 749 ++++++++++++++++-- 1 file changed, 663 insertions(+), 86 deletions(-) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index 8f6d308cfa..fa57a94487 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -171,131 +171,227 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' true, now(), 1, now(), 1), ((select id from devtron_resource where kind = 'release'), 'alpha1', '{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "Release Schema", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Release Schema", + "type": "object", + "properties": + { + "kind": + { + "const": "release" + }, + "version": + { + "type": "string", + "enum": + [ + "alpha1" + ] + }, + "overview": + { "type": "object", "properties": { - "kind": + "id": { - "const": "release" + "type": "number" }, - "version": + "idType": { "type": "string", - "enum": ["alpha1"] + "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release we keep data as devtron resource only. To differ between nature of these two types of id values.", + "enum": + [ + "resourceObjectId", + "oldObjectId" + ] }, - "overview": + "releaseVersion": + { + "type": "string" + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "note": + { + "type": "string" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": { "type": "object", "properties": { - "id": + "Type of release": { - "type": "number" - }, - "idType":{ "type": "string", - "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceObjectId", "oldObjectId"] - }, - "releaseVersion": - { - "type": "string" - }, - "name": - { - "type": "string" + "enum": + [ + "Major", + "Minor", + "Patch" + ] }, - "icon": + "Milestones": { - "type": "string", - "contentEncoding": "base64" + "type": "object", + "properties": + { + "Release planned start date": + { + "type": "string", + "format": "date" + }, + "30% milestone date": + { + "type": "string", + "format": "date" + }, + "70% milestone date": + { + "type": "string", + "format": "date" + }, + "Release end date": + { + "type": "string", + "format": "date" + } + } }, - "note": + "Release Managers": { - "type":"string" - }, - "description": - { - "type": "string" + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } }, - "createdOn": + "On-Duty": { - "type": "string" + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } }, - "createdBy": + "Target customers": { - "type": "object", - "refType": "#/references/users" + "type": "array", + "uniqueItems": true, + "items": + { + "type": "string" + } }, - "tags": + "Released customers": { - "additionalProperties": + "type": "array", + "uniqueItems": true, + "items": { "type": "string" } - }, - "metadata": - {} + } }, "required": [ - "id", - "releaseVersion" + "Type of release", + "Release Managers", + "On-Duty" ] - }, - "status": + } + }, + "required": + [ + "id", + "releaseVersion" + ] + }, + "status": + { + "type": "object", + "properties": + { + "config": { "type": "object", "properties": { - "config": + "status": { - "type": "object", - "properties": { - "status": - { - "type":"string", - "enum": [ - "draft", - "readyForRelease", - "hold" - ] - }, - "lock": - { - "type": "boolean" - } - }, - "required": + "type": "string", + "enum": [ - "status" + "draft", + "readyForRelease", + "hold" ] + }, + "lock": + { + "type": "boolean" } }, "required": [ - "config" + "status" ] - }, - "taskMapping": - { - "type": "array" - }, - "dependencies": - { - "type": "array" } }, "required": [ - "version", - "kind", - "overview", - "status" + "config" ] - }', '{ + }, + "taskMapping": + { + "type": "array" + }, + "dependencies": + { + "type": "array" + } + }, + "required": + [ + "version", + "kind", + "overview", + "status" + ] +}', '{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Release Schema", "type": "object", @@ -308,7 +404,10 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "version": { "type": "string", - "enum": ["alpha1"] + "enum": + [ + "alpha1" + ] }, "overview": { @@ -319,10 +418,15 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' { "type": "number" }, - "idType":{ + "idType": + { "type": "string", "description": "for existing resources in the system we keep original ids of their tables in id field. Like id of apps table is kept for devtron applications. But in release we keep data as devtron resource only. To differ between nature of these two types of id values.", - "enum": ["resourceObjectId", "oldObjectId"] + "enum": + [ + "resourceObjectId", + "oldObjectId" + ] }, "releaseVersion": { @@ -339,7 +443,7 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' }, "note": { - "type":"string" + "type": "string" }, "description": { @@ -362,7 +466,93 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' } }, "metadata": - {} + { + "type": "object", + "properties": + { + "Type of release": + { + "type": "string", + "enum": + [ + "Major", + "Minor", + "Patch" + ] + }, + "Milestones": + { + "type": "object", + "properties": + { + "Release planned start date": + { + "type": "string", + "format": "date" + }, + "30% milestone date": + { + "type": "string", + "format": "date" + }, + "70% milestone date": + { + "type": "string", + "format": "date" + }, + "Release end date": + { + "type": "string", + "format": "date" + } + } + }, + "Release Managers": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "On-Duty": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "Target customers": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "string" + } + }, + "Released customers": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "string" + } + } + }, + "required": + [ + "Type of release", + "Release Managers", + "On-Duty" + ] + } }, "required": [ @@ -378,11 +568,13 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "config": { "type": "object", - "properties": { + "properties": + { "status": { - "type":"string", - "enum": [ + "type": "string", + "enum": + [ "draft", "readyForRelease", "hold" @@ -1229,4 +1421,389 @@ set schema='{ ] }' where devtron_resource_id = (select id from devtron_resource where kind = 'helm-application') - and version = 'v1'; \ No newline at end of file + and version = 'v1'; + + +INSERT INTO global_policy(name, policy_of, version, description, policy_json, enabled, deleted, created_by, created_on, updated_by, updated_on) +VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validation release status changes.','' || + '{ + "definitions": + [ + { + "to": + { + "configStatus": "draft", + "dependencyArtifactCount": "noImageSelected", + "releaseStatus": "notDeployed", + "lockStatus": false + }, + "possibleFrom": + [ + { + "configStatus": "draft", + "dependencyArtifactCount": "noImageSelected", + "releaseStatus": "notDeployed", + "lockStatus": true + } + ] + }, + { + "to": + { + "configStatus": "draft", + "dependencyArtifactCount": "noImageSelected", + "releaseStatus": "notDeployed", + "lockStatus": true + }, + "possibleFrom": + [ + { + "configStatus": "draft", + "dependencyArtifactCount": "noImageSelected", + "releaseStatus": "notDeployed", + "lockStatus": false + } + ] + }, + { + "to": + { + "configStatus": "draft", + "dependencyArtifactCount": "partialImagesSelected", + "releaseStatus": "notDeployed", + "lockStatus": false + }, + "possibleFrom": + [ + { + "configStatus": "draft", + "dependencyArtifactCount": "partialImagesSelected", + "releaseStatus": "notDeployed", + "lockStatus": true + } + ] + }, + { + "to": + { + "configStatus": "draft", + "dependencyArtifactCount": "partialImagesSelected", + "releaseStatus": "notDeployed", + "lockStatus": true + }, + "possibleFrom": + [ + { + "configStatus": "draft", + "dependencyArtifactCount": "partialImagesSelected", + "releaseStatus": "notDeployed", + "lockStatus": false + } + ] + }, + { + "to": + { + "configStatus": "draft", + "dependencyArtifactCount": "allImagesSelected", + "releaseStatus": "notDeployed", + "lockStatus": false + }, + "possibleFrom": + [ + { + "configStatus": "draft", + "dependencyArtifactCount": "allImagesSelected", + "releaseStatus": "notDeployed", + "lockStatus": true + }, + { + "configStatus": "draft", + "dependencyArtifactCount": "noImageSelected", + "releaseStatus": "notDeployed", + "lockStatus": false + }, + { + "configStatus": "draft", + "dependencyArtifactCount": "partialImagesSelected", + "releaseStatus": "notDeployed", + "lockStatus": false + } + ] + }, + { + "to": + { + "configStatus": "readyForRelease", + "releaseStatus": "notDeployed", + "dependencyArtifactCount": "allImagesSelected" + }, + "possibleFrom": + [ + { + "configStatus": "draft", + "dependencyArtifactCount": "allImagesSelected", + "releaseStatus": "notDeployed", + "lockStatus": false + }, + { + "configStatus": "draft", + "dependencyArtifactCount": "allImagesSelected", + "releaseStatus": "notDeployed", + "lockStatus": true + } + ], + "autoAction": + { + "configStatus": "readyForRelease", + "lockStatus": true + } + }, + { + "to": + { + "configStatus": "readyForRelease", + "releaseStatus": "notDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + }, + "possibleFrom": + [ + { + "configStatus": "readyForRelease", + "releaseStatus": "notDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + } + ], + "autoAction": + { + "configStatus": "draft", + "lockStatus": false + } + }, + { + "to": + { + "configStatus": "readyForRelease", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + }, + "possibleFrom": + [ + { + "configStatus": "readyForRelease", + "releaseStatus": "notDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + } + ] + }, + { + "to": + { + "configStatus": "readyForRelease", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + }, + "possibleFrom": + [ + { + "configStatus": "readyForRelease", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + } + ], + "autoAction": + { + "configStatus": "hold", + "lockStatus": false + } + }, + { + "to": + { + "configStatus": "readyForRelease", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected" + }, + "possibleFrom": + [ + { + "configStatus": "hold", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + }, + { + "configStatus": "hold", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + } + ], + "autoAction": + { + "configStatus": "readyForRelease", + "lockStatus": true + } + }, + { + "to": + { + "configStatus": "readyForRelease", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + }, + "possibleFrom": + [ + { + "configStatus": "readyForRelease", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + } + ] + }, + { + "to": + { + "configStatus": "readyForRelease", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + }, + "possibleFrom": + [ + { + "configStatus": "readyForRelease", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + } + ], + "autoAction": + { + "configStatus": "hold", + "lockStatus": false + } + }, + { + "to": + { + "configStatus": "readyForRelease", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected" + }, + "possibleFrom": + [ + { + "configStatus": "hold", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + }, + { + "configStatus": "hold", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + } + ], + "autoAction": + { + "configStatus": "readyForRelease", + "lockStatus": true + } + }, + { + "to": + { + "configStatus": "hold", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + }, + "possibleFrom": + [ + { + "configStatus": "readyForRelease", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + }, + { + "configStatus": "hold", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + } + ] + }, + { + "to": + { + "configStatus": "hold", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + }, + "possibleFrom": + [ + { + "configStatus": "hold", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + } + ] + }, + { + "to": + { + "configStatus": "hold", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + }, + "possibleFrom": + [ + { + "configStatus": "readyForRelease", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + }, + { + "configStatus": "hold", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + } + ] + }, + { + "to": + { + "configStatus": "hold", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": false + }, + "possibleFrom": + [ + { + "configStatus": "hold", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + } + ] + } + ], + "consequence": "BLOCK" +}', true, false, 1, now(),1,now()); \ No newline at end of file From 9ddad037a6ec1c1cbae912dd2e2828db7e7d021f Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Thu, 2 May 2024 03:16:56 +0530 Subject: [PATCH 16/34] added rescind status change policy handling --- .../241_alter_resource_release_feature.up.sql | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index fa57a94487..736544f759 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -1425,8 +1425,8 @@ where devtron_resource_id = (select id from devtron_resource where kind = 'helm- INSERT INTO global_policy(name, policy_of, version, description, policy_json, enabled, deleted, created_by, created_on, updated_by, updated_on) -VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validation release status changes.','' || - '{ +VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validation release status changes.', +'{ "definitions": [ { @@ -1803,6 +1803,52 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "lockStatus": true } ] + }, + { + "to": + { + "configStatus": "rescind", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected" + }, + "possibleFrom": + [ + { + "configStatus": "readyForRelease", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + }, + { + "configStatus": "hold", + "releaseStatus": "completelyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + } + ] + }, + { + "to": + { + "configStatus": "rescind", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected" + }, + "possibleFrom": + [ + { + "configStatus": "readyForRelease", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + }, + { + "configStatus": "hold", + "releaseStatus": "partiallyDeployed", + "dependencyArtifactCount": "allImagesSelected", + "lockStatus": true + } + ] } ], "consequence": "BLOCK" From d73bd16277b995305dd4ec891871225c11a65998 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Thu, 2 May 2024 11:24:03 +0530 Subject: [PATCH 17/34] renaming policy json field --- .../241_alter_resource_release_feature.up.sql | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index 736544f759..cc006be019 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -1434,7 +1434,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "noImageSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": false }, "possibleFrom": @@ -1442,7 +1442,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "noImageSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": true } ] @@ -1452,7 +1452,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "noImageSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": true }, "possibleFrom": @@ -1460,7 +1460,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "noImageSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": false } ] @@ -1470,7 +1470,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "partialImagesSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": false }, "possibleFrom": @@ -1478,7 +1478,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "partialImagesSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": true } ] @@ -1488,7 +1488,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "partialImagesSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": true }, "possibleFrom": @@ -1496,7 +1496,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "partialImagesSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": false } ] @@ -1506,7 +1506,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "allImagesSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": false }, "possibleFrom": @@ -1514,19 +1514,19 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "allImagesSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": true }, { "configStatus": "draft", "dependencyArtifactCount": "noImageSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": false }, { "configStatus": "draft", "dependencyArtifactCount": "partialImagesSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": false } ] @@ -1535,7 +1535,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "readyForRelease", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "dependencyArtifactCount": "allImagesSelected" }, "possibleFrom": @@ -1543,13 +1543,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio { "configStatus": "draft", "dependencyArtifactCount": "allImagesSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": false }, { "configStatus": "draft", "dependencyArtifactCount": "allImagesSelected", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "lockStatus": true } ], @@ -1563,7 +1563,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "readyForRelease", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false }, @@ -1571,7 +1571,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio [ { "configStatus": "readyForRelease", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true } @@ -1586,7 +1586,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "readyForRelease", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true }, @@ -1594,7 +1594,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio [ { "configStatus": "readyForRelease", - "releaseStatus": "notDeployed", + "rolloutStatus": "notDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true } @@ -1604,7 +1604,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "readyForRelease", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false }, @@ -1612,7 +1612,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio [ { "configStatus": "readyForRelease", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true } @@ -1627,20 +1627,20 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "readyForRelease", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected" }, "possibleFrom": [ { "configStatus": "hold", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false }, { "configStatus": "hold", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false } @@ -1655,7 +1655,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "readyForRelease", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true }, @@ -1663,7 +1663,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio [ { "configStatus": "readyForRelease", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true } @@ -1673,7 +1673,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "readyForRelease", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false }, @@ -1681,7 +1681,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio [ { "configStatus": "readyForRelease", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true } @@ -1696,20 +1696,20 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "readyForRelease", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected" }, "possibleFrom": [ { "configStatus": "hold", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false }, { "configStatus": "hold", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false } @@ -1724,7 +1724,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "hold", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true }, @@ -1732,13 +1732,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio [ { "configStatus": "readyForRelease", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true }, { "configStatus": "hold", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false } @@ -1748,7 +1748,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "hold", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false }, @@ -1756,7 +1756,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio [ { "configStatus": "hold", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true } @@ -1766,7 +1766,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "hold", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true }, @@ -1774,13 +1774,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio [ { "configStatus": "readyForRelease", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true }, { "configStatus": "hold", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false } @@ -1790,7 +1790,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "hold", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": false }, @@ -1798,7 +1798,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio [ { "configStatus": "hold", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true } @@ -1808,20 +1808,20 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "rescind", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected" }, "possibleFrom": [ { "configStatus": "readyForRelease", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true }, { "configStatus": "hold", - "releaseStatus": "completelyDeployed", + "rolloutStatus": "completelyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true } @@ -1831,20 +1831,20 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validatio "to": { "configStatus": "rescind", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected" }, "possibleFrom": [ { "configStatus": "readyForRelease", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true }, { "configStatus": "hold", - "releaseStatus": "partiallyDeployed", + "rolloutStatus": "partiallyDeployed", "dependencyArtifactCount": "allImagesSelected", "lockStatus": true } From b4da2a118a7c1a302b11e2968420306385e6c1dc Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Thu, 2 May 2024 12:52:51 +0530 Subject: [PATCH 18/34] updated schema ordering --- .../241_alter_resource_release_feature.up.sql | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index cc006be019..e77cfcf4c3 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -259,6 +259,26 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "Patch" ] }, + "Release Managers": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "On-Duty": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, "Milestones": { "type": "object", @@ -286,26 +306,6 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' } } }, - "Release Managers": - { - "type": "array", - "uniqueItems": true, - "items": - { - "type": "object", - "refType": "#/references/users" - } - }, - "On-Duty": - { - "type": "array", - "uniqueItems": true, - "items": - { - "type": "object", - "refType": "#/references/users" - } - }, "Target customers": { "type": "array", @@ -480,6 +480,26 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "Patch" ] }, + "Release Managers": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "On-Duty": + { + "type": "array", + "uniqueItems": true, + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, "Milestones": { "type": "object", @@ -507,26 +527,6 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' } } }, - "Release Managers": - { - "type": "array", - "uniqueItems": true, - "items": - { - "type": "object", - "refType": "#/references/users" - } - }, - "On-Duty": - { - "type": "array", - "uniqueItems": true, - "items": - { - "type": "object", - "refType": "#/references/users" - } - }, "Target customers": { "type": "array", From 3644fb4b3bb69602113ecc06af4683b9be7f5a2e Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Thu, 2 May 2024 14:08:29 +0530 Subject: [PATCH 19/34] updated global policy version --- scripts/sql/241_alter_resource_release_feature.up.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index e77cfcf4c3..235df196fc 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -1425,7 +1425,7 @@ where devtron_resource_id = (select id from devtron_resource where kind = 'helm- INSERT INTO global_policy(name, policy_of, version, description, policy_json, enabled, deleted, created_by, created_on, updated_by, updated_on) -VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'v1', 'Policy used for validation release status changes.', +VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validation release status changes.', '{ "definitions": [ From 385baf7aac59a38232986d18d2660c2330db58a2 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Thu, 2 May 2024 14:16:35 +0530 Subject: [PATCH 20/34] updated policy json --- .../241_alter_resource_release_feature.up.sql | 170 +++++++++--------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index 235df196fc..ff8be01441 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -1430,125 +1430,125 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "definitions": [ { - "to": + "stateTo": { "configStatus": "draft", - "dependencyArtifactCount": "noImageSelected", + "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", "lockStatus": false }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "draft", - "dependencyArtifactCount": "noImageSelected", + "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", "lockStatus": true } ] }, { - "to": + "stateTo": { "configStatus": "draft", - "dependencyArtifactCount": "noImageSelected", + "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", "lockStatus": true }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "draft", - "dependencyArtifactCount": "noImageSelected", + "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", "lockStatus": false } ] }, { - "to": + "stateTo": { "configStatus": "draft", - "dependencyArtifactCount": "partialImagesSelected", + "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", "lockStatus": false }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "draft", - "dependencyArtifactCount": "partialImagesSelected", + "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", "lockStatus": true } ] }, { - "to": + "stateTo": { "configStatus": "draft", - "dependencyArtifactCount": "partialImagesSelected", + "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", "lockStatus": true }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "draft", - "dependencyArtifactCount": "partialImagesSelected", + "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", "lockStatus": false } ] }, { - "to": + "stateTo": { "configStatus": "draft", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "rolloutStatus": "notDeployed", "lockStatus": false }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "draft", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "rolloutStatus": "notDeployed", "lockStatus": true }, { "configStatus": "draft", - "dependencyArtifactCount": "noImageSelected", + "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", "lockStatus": false }, { "configStatus": "draft", - "dependencyArtifactCount": "partialImagesSelected", + "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", "lockStatus": false } ] }, { - "to": + "stateTo": { "configStatus": "readyForRelease", "rolloutStatus": "notDeployed", - "dependencyArtifactCount": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected" }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "draft", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "rolloutStatus": "notDeployed", "lockStatus": false }, { "configStatus": "draft", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "rolloutStatus": "notDeployed", "lockStatus": true } @@ -1560,19 +1560,19 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio } }, { - "to": + "stateTo": { "configStatus": "readyForRelease", "rolloutStatus": "notDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "readyForRelease", "rolloutStatus": "notDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true } ], @@ -1583,37 +1583,37 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio } }, { - "to": + "stateTo": { "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "readyForRelease", "rolloutStatus": "notDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true } ] }, { - "to": + "stateTo": { "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true } ], @@ -1624,24 +1624,24 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio } }, { - "to": + "stateTo": { "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected" }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false }, { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false } ], @@ -1652,37 +1652,37 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio } }, { - "to": + "stateTo": { "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true } ] }, { - "to": + "stateTo": { "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true } ], @@ -1693,24 +1693,24 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio } }, { - "to": + "stateTo": { "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected" }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "hold", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false }, { "configStatus": "hold", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false } ], @@ -1721,131 +1721,131 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio } }, { - "to": + "stateTo": { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true }, { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false } ] }, { - "to": + "stateTo": { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true } ] }, { - "to": + "stateTo": { "configStatus": "hold", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true }, { "configStatus": "hold", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false } ] }, { - "to": + "stateTo": { "configStatus": "hold", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": false }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "hold", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true } ] }, { - "to": + "stateTo": { "configStatus": "rescind", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected" }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true }, { "configStatus": "hold", "rolloutStatus": "completelyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true } ] }, { - "to": + "stateTo": { "configStatus": "rescind", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected" }, - "possibleFrom": + "possibleFromStates": [ { "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true }, { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactCount": "allImagesSelected", + "dependencyArtifactStatus": "allImagesSelected", "lockStatus": true } ] From e90c92d46eb92f483db470e8f92e2a60b38c1afd Mon Sep 17 00:00:00 2001 From: Shivam-nagar23 Date: Fri, 3 May 2024 19:45:01 +0530 Subject: [PATCH 21/34] prod bug fix --- pkg/bulkAction/BulkUpdateService.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/bulkAction/BulkUpdateService.go b/pkg/bulkAction/BulkUpdateService.go index 7fff668c49..5896c270c5 100644 --- a/pkg/bulkAction/BulkUpdateService.go +++ b/pkg/bulkAction/BulkUpdateService.go @@ -1317,7 +1317,7 @@ func (impl BulkUpdateServiceImpl) BulkDeploy(request *BulkApplicationForEnvironm continue } artifact := artifacts[0] - err = impl.cdPipelineEventPublishService.PublishBulkTriggerTopicEvent(pipeline.Id, pipeline.AppId, artifact.CiPipelineId, request.UserId) + err = impl.cdPipelineEventPublishService.PublishBulkTriggerTopicEvent(pipeline.Id, pipeline.AppId, artifact.Id, request.UserId) if err != nil { impl.logger.Errorw("error, PublishBulkTriggerTopicEvent", "err", err, "pipeline", pipeline) pipelineResponse := response[appKey] From 9e707018bb4ac6fda37b48199ecf8c2453a37c2b Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Sun, 5 May 2024 20:49:18 +0530 Subject: [PATCH 22/34] updated policy lock status --- .../241_alter_resource_release_feature.up.sql | 111 +++++++++--------- 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index ff8be01441..8399d2cf24 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -1435,7 +1435,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", - "lockStatus": false + "lockStatus": "unLocked" }, "possibleFromStates": [ @@ -1443,7 +1443,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", - "lockStatus": true + "lockStatus": "locked" } ] }, @@ -1453,7 +1453,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", - "lockStatus": true + "lockStatus": "locked" }, "possibleFromStates": [ @@ -1461,7 +1461,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", - "lockStatus": false + "lockStatus": "unLocked" } ] }, @@ -1471,7 +1471,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", - "lockStatus": false + "lockStatus": "unLocked" }, "possibleFromStates": [ @@ -1479,7 +1479,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", - "lockStatus": true + "lockStatus": "locked" } ] }, @@ -1489,7 +1489,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", - "lockStatus": true + "lockStatus": "locked" }, "possibleFromStates": [ @@ -1497,7 +1497,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", - "lockStatus": false + "lockStatus": "unLocked" } ] }, @@ -1507,7 +1507,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "allImagesSelected", "rolloutStatus": "notDeployed", - "lockStatus": false + "lockStatus": "unLocked" }, "possibleFromStates": [ @@ -1515,19 +1515,19 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "allImagesSelected", "rolloutStatus": "notDeployed", - "lockStatus": true + "lockStatus": "locked" }, { "configStatus": "draft", "dependencyArtifactStatus": "noImageSelected", "rolloutStatus": "notDeployed", - "lockStatus": false + "lockStatus": "unLocked" }, { "configStatus": "draft", "dependencyArtifactStatus": "partialImagesSelected", "rolloutStatus": "notDeployed", - "lockStatus": false + "lockStatus": "unLocked" } ] }, @@ -1536,7 +1536,8 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio { "configStatus": "readyForRelease", "rolloutStatus": "notDeployed", - "dependencyArtifactStatus": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" }, "possibleFromStates": [ @@ -1544,19 +1545,19 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "draft", "dependencyArtifactStatus": "allImagesSelected", "rolloutStatus": "notDeployed", - "lockStatus": false + "lockStatus": "unLocked" }, { "configStatus": "draft", "dependencyArtifactStatus": "allImagesSelected", "rolloutStatus": "notDeployed", - "lockStatus": true + "lockStatus": "locked" } ], "autoAction": { "configStatus": "readyForRelease", - "lockStatus": true + "lockStatus": "locked" } }, { @@ -1565,7 +1566,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "notDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" }, "possibleFromStates": [ @@ -1573,13 +1574,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "notDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" } ], "autoAction": { "configStatus": "draft", - "lockStatus": false + "lockStatus": "unLocked" } }, { @@ -1588,7 +1589,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" }, "possibleFromStates": [ @@ -1596,7 +1597,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "notDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" } ] }, @@ -1606,7 +1607,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" }, "possibleFromStates": [ @@ -1614,13 +1615,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" } ], "autoAction": { "configStatus": "hold", - "lockStatus": false + "lockStatus": "unLocked" } }, { @@ -1628,7 +1629,8 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio { "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" }, "possibleFromStates": [ @@ -1636,19 +1638,19 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" }, { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" } ], "autoAction": { "configStatus": "readyForRelease", - "lockStatus": true + "lockStatus": "locked" } }, { @@ -1657,7 +1659,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" }, "possibleFromStates": [ @@ -1665,7 +1667,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" } ] }, @@ -1675,7 +1677,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" }, "possibleFromStates": [ @@ -1683,13 +1685,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" } ], "autoAction": { "configStatus": "hold", - "lockStatus": false + "lockStatus": "unLocked" } }, { @@ -1697,7 +1699,8 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio { "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" }, "possibleFromStates": [ @@ -1705,19 +1708,19 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" }, { "configStatus": "hold", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" } ], "autoAction": { "configStatus": "readyForRelease", - "lockStatus": true + "lockStatus": "locked" } }, { @@ -1726,7 +1729,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" }, "possibleFromStates": [ @@ -1734,13 +1737,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" }, { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" } ] }, @@ -1750,7 +1753,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" }, "possibleFromStates": [ @@ -1758,7 +1761,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" } ] }, @@ -1768,7 +1771,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" }, "possibleFromStates": [ @@ -1776,13 +1779,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" }, { "configStatus": "hold", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" } ] }, @@ -1792,7 +1795,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": false + "lockStatus": "unLocked" }, "possibleFromStates": [ @@ -1800,7 +1803,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" } ] }, @@ -1809,7 +1812,8 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio { "configStatus": "rescind", "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" }, "possibleFromStates": [ @@ -1817,13 +1821,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" }, { "configStatus": "hold", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" } ] }, @@ -1832,7 +1836,8 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio { "configStatus": "rescind", "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected" + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" }, "possibleFromStates": [ @@ -1840,13 +1845,13 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "readyForRelease", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" }, { "configStatus": "hold", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": true + "lockStatus": "locked" } ] } From 1a5ffc1769bdccf7a366307b793f32e4a1b1aeef Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Mon, 6 May 2024 00:25:51 +0530 Subject: [PATCH 23/34] added action check policy release --- .../241_alter_resource_release_feature.up.sql | 109 +++++++++++++++++- 1 file changed, 108 insertions(+), 1 deletion(-) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index 8399d2cf24..a7e80cc876 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -1857,4 +1857,111 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio } ], "consequence": "BLOCK" -}', true, false, 1, now(),1,now()); \ No newline at end of file +}', true, false, 1, now(),1,now()), + ('ReleaseActionCheckPolicy', 'RELEASE_ACTION_CHECK', 'V1', 'Policy used for validating different actions requested on release.', + '{ + "definitions": + [ + { + "operationType": "patch", + "operationPaths": + [ + "overview.description", + "overview.releaseNote", + "overview.tags", + "overview.name", + "overview.metadata", + "status.config.lock", + "status.config", + "dependency.applications.instruction" + ], + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "*", + "rolloutStatus": "*", + "lockStatus": "*" + }, + { + "configStatus": "readyForRelease", + "dependencyArtifactStatus": "*", + "rolloutStatus": "*", + "lockStatus": "*" + }, + { + "configStatus": "hold", + "dependencyArtifactStatus": "*", + "rolloutStatus": "*", + "lockStatus": "*" + } + ] + }, + { + "operationType": "patch", + "operationPaths": + [ + "dependency.applications", + "dependency.applications.image" + ], + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "*", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + } + ] + }, + { + "operationType": "deploymentTrigger", + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "dependencyArtifactStatus": "*", + "rolloutStatus": "*", + "lockStatus": "locked" + } + ] + }, + { + "operationType": "delete", + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "*", + "rolloutStatus": "notDeployed", + "lockStatus": "*" + }, + { + "configStatus": "readyForRelease", + "dependencyArtifactStatus": "*", + "rolloutStatus": "notDeployed", + "lockStatus": "*" + }, + { + "configStatus": "hold", + "dependencyArtifactStatus": "*", + "rolloutStatus": "notDeployed", + "lockStatus": "*" + }, + { + "configStatus": "rescind", + "dependencyArtifactStatus": "*", + "rolloutStatus": "*", + "lockStatus": "*" + }, + { + "configStatus": "corrupted", + "dependencyArtifactStatus": "*", + "rolloutStatus": "*", + "lockStatus": "*" + } + ] + } + ], + "consequence": "BLOCK" +}', true, false, 1, now(),1,now()) \ No newline at end of file From 56374d88021916aba380f8fc0b732fe7334655e8 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Mon, 6 May 2024 01:13:37 +0530 Subject: [PATCH 24/34] wip --- scripts/sql/241_alter_resource_release_feature.up.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index a7e80cc876..1511935b4f 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -1964,4 +1964,4 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio } ], "consequence": "BLOCK" -}', true, false, 1, now(),1,now()) \ No newline at end of file +}', true, false, 1, now(),1,now()); \ No newline at end of file From c5f795721b55c2ba205435ab4743deb0de9a3f43 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Mon, 6 May 2024 12:41:09 +0530 Subject: [PATCH 25/34] updated policy for release status --- .../241_alter_resource_release_feature.up.sql | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/241_alter_resource_release_feature.up.sql index 1511935b4f..e1b029814d 100644 --- a/scripts/sql/241_alter_resource_release_feature.up.sql +++ b/scripts/sql/241_alter_resource_release_feature.up.sql @@ -1501,6 +1501,30 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio } ] }, + { + "stateTo": + { + "configStatus": "draft", + "dependencyArtifactStatus": "allImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "locked" + }, + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "allImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + }, + { + "configStatus": "readyForRelease", + "rolloutStatus": "notDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ] + }, { "stateTo": { From d5855115920b5a40cdcf12aa7800ea10ed3351a4 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Mon, 6 May 2024 13:27:11 +0530 Subject: [PATCH 26/34] updated down sql --- scripts/sql/241_alter_resource_release_feature.down.sql | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/sql/241_alter_resource_release_feature.down.sql b/scripts/sql/241_alter_resource_release_feature.down.sql index 7a364f737e..b3780c573f 100644 --- a/scripts/sql/241_alter_resource_release_feature.down.sql +++ b/scripts/sql/241_alter_resource_release_feature.down.sql @@ -2,4 +2,10 @@ ALTER TABLE devtron_resource_object DROP COLUMN identifier; ALTER TABLE devtron_resource_object_audit - DROP COLUMN audit_operation_path; \ No newline at end of file + DROP COLUMN audit_operation_path; + +DELETE FROM devtron_resource_schema where devtron_resource_id in (select id from devtron_resource where kind in('release-track', 'release')); + +DELETE FROM devtron_resource where kind in('release-track', 'release'); + +DELETE FROM global_policy where policy_of in('RELEASE_STATUS', 'RELEASE_ACTION_CHECK'); \ No newline at end of file From f596559d8ed53da7e223553c2d6980c8db9a3b18 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Mon, 6 May 2024 16:49:58 +0530 Subject: [PATCH 27/34] updated sql script no. --- ...ature.down.sql => 244_alter_resource_release_feature.down.sql} | 0 ...e_feature.up.sql => 244_alter_resource_release_feature.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts/sql/{241_alter_resource_release_feature.down.sql => 244_alter_resource_release_feature.down.sql} (100%) rename scripts/sql/{241_alter_resource_release_feature.up.sql => 244_alter_resource_release_feature.up.sql} (100%) diff --git a/scripts/sql/241_alter_resource_release_feature.down.sql b/scripts/sql/244_alter_resource_release_feature.down.sql similarity index 100% rename from scripts/sql/241_alter_resource_release_feature.down.sql rename to scripts/sql/244_alter_resource_release_feature.down.sql diff --git a/scripts/sql/241_alter_resource_release_feature.up.sql b/scripts/sql/244_alter_resource_release_feature.up.sql similarity index 100% rename from scripts/sql/241_alter_resource_release_feature.up.sql rename to scripts/sql/244_alter_resource_release_feature.up.sql From 5af3ba83cc963f6135ac58c93e17655f37bd02b5 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Mon, 6 May 2024 18:34:59 +0530 Subject: [PATCH 28/34] fixed autocorrect issues --- scripts/sql/244_alter_resource_release_feature.up.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/sql/244_alter_resource_release_feature.up.sql b/scripts/sql/244_alter_resource_release_feature.up.sql index e1b029814d..0b7e5321e5 100644 --- a/scripts/sql/244_alter_resource_release_feature.up.sql +++ b/scripts/sql/244_alter_resource_release_feature.up.sql @@ -1668,7 +1668,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "partiallyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" + "lockStatus": "locked" } ], "autoAction": @@ -1738,7 +1738,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "configStatus": "hold", "rolloutStatus": "completelyDeployed", "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" + "lockStatus": "locked" } ], "autoAction": From 89869394d4502c2bf1fe7f081cfbfa94c11e3489 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Tue, 7 May 2024 12:11:31 +0530 Subject: [PATCH 29/34] added first released on key for release --- scripts/sql/244_alter_resource_release_feature.up.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/sql/244_alter_resource_release_feature.up.sql b/scripts/sql/244_alter_resource_release_feature.up.sql index 0b7e5321e5..ffa1bd36d4 100644 --- a/scripts/sql/244_alter_resource_release_feature.up.sql +++ b/scripts/sql/244_alter_resource_release_feature.up.sql @@ -207,6 +207,11 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "oldObjectId" ] }, + "firstReleasedOn": + { + "type": "string", + "format": "date" + }, "releaseVersion": { "type": "string" @@ -428,6 +433,11 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "oldObjectId" ] }, + "firstReleasedOn": + { + "type": "string", + "format": "date" + }, "releaseVersion": { "type": "string" From 8662f8c33f6a616bbdc1ea3e3820302265731b80 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Tue, 7 May 2024 15:45:10 +0530 Subject: [PATCH 30/34] updated task run migration --- .../244_alter_resource_release_feature.up.sql | 942 +++++++++--------- 1 file changed, 485 insertions(+), 457 deletions(-) diff --git a/scripts/sql/244_alter_resource_release_feature.up.sql b/scripts/sql/244_alter_resource_release_feature.up.sql index ffa1bd36d4..f1e98d4902 100644 --- a/scripts/sql/244_alter_resource_release_feature.up.sql +++ b/scripts/sql/244_alter_resource_release_feature.up.sql @@ -1433,466 +1433,494 @@ set schema='{ where devtron_resource_id = (select id from devtron_resource where kind = 'helm-application') and version = 'v1'; +-- create devtron resource task run table +CREATE SEQUENCE IF NOT EXISTS id_devtron_resource_task_run; +CREATE TABLE IF NOT EXISTS public.devtron_resource_task_run +( + "created_by" int4 NOT NULL, + "updated_by" int4 NOT NULL, + "created_on" timestamptz NOT NULL, + "updated_on" timestamptz NOT NULL, + "id" int NOT NULL DEFAULT nextval('id_devtron_resource_task_run'::regclass), + "task_json" jsonb NOT NULL , + "run_source_identifier" varchar(500) NOT NULL, + "run_source_dependency_identifier" varchar(500) NOT NULL, + "task_type" varchar(100) NOT NULL, + "task_type_identifier" int NOT NULL, + PRIMARY KEY ("id") +); + +-- unique index on combinaton of task type and task_type_identifier +CREATE UNIQUE INDEX "idx_unique_task_type_and_identifier_id" + ON devtron_resource_task_run(task_type,task_type_identifier); + +-- index on run_source_identifier +CREATE INDEX "idx_run_source_identifier" ON devtron_resource_task_run USING BTREE ("run_source_identifier"); + +-- index on run_source_dependency_identifier +CREATE INDEX "idx_run_source_dependency_identifier" ON devtron_resource_task_run USING BTREE ("run_source_dependency_identifier"); + + INSERT INTO global_policy(name, policy_of, version, description, policy_json, enabled, deleted, created_by, created_on, updated_by, updated_on) VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validation release status changes.', -'{ - "definitions": - [ - { - "stateTo": - { - "configStatus": "draft", - "dependencyArtifactStatus": "noImageSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "unLocked" - }, - "possibleFromStates": - [ - { - "configStatus": "draft", - "dependencyArtifactStatus": "noImageSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "locked" - } - ] - }, - { - "stateTo": - { - "configStatus": "draft", - "dependencyArtifactStatus": "noImageSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "locked" - }, - "possibleFromStates": - [ - { - "configStatus": "draft", - "dependencyArtifactStatus": "noImageSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "unLocked" - } - ] - }, - { - "stateTo": - { - "configStatus": "draft", - "dependencyArtifactStatus": "partialImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "unLocked" - }, - "possibleFromStates": - [ - { - "configStatus": "draft", - "dependencyArtifactStatus": "partialImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "locked" - } - ] - }, - { - "stateTo": - { - "configStatus": "draft", - "dependencyArtifactStatus": "partialImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "locked" - }, - "possibleFromStates": - [ - { - "configStatus": "draft", - "dependencyArtifactStatus": "partialImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "unLocked" - } - ] - }, - { - "stateTo": - { - "configStatus": "draft", - "dependencyArtifactStatus": "allImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "locked" - }, - "possibleFromStates": - [ - { - "configStatus": "draft", - "dependencyArtifactStatus": "allImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "unLocked" - }, - { - "configStatus": "readyForRelease", - "rolloutStatus": "notDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ] - }, - { - "stateTo": - { - "configStatus": "draft", - "dependencyArtifactStatus": "allImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "unLocked" - }, - "possibleFromStates": - [ - { - "configStatus": "draft", - "dependencyArtifactStatus": "allImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "locked" - }, - { - "configStatus": "draft", - "dependencyArtifactStatus": "noImageSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "unLocked" - }, - { - "configStatus": "draft", - "dependencyArtifactStatus": "partialImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "unLocked" - } - ] - }, - { - "stateTo": - { - "configStatus": "readyForRelease", - "rolloutStatus": "notDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "*" - }, - "possibleFromStates": - [ - { - "configStatus": "draft", - "dependencyArtifactStatus": "allImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "unLocked" - }, - { - "configStatus": "draft", - "dependencyArtifactStatus": "allImagesSelected", - "rolloutStatus": "notDeployed", - "lockStatus": "locked" - } - ], - "autoAction": - { - "configStatus": "readyForRelease", - "lockStatus": "locked" - } - }, - { - "stateTo": - { - "configStatus": "readyForRelease", - "rolloutStatus": "notDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" - }, - "possibleFromStates": - [ - { - "configStatus": "readyForRelease", - "rolloutStatus": "notDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ], - "autoAction": - { - "configStatus": "draft", - "lockStatus": "unLocked" - } - }, - { - "stateTo": - { - "configStatus": "readyForRelease", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - }, - "possibleFromStates": - [ - { - "configStatus": "readyForRelease", - "rolloutStatus": "notDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ] - }, - { - "stateTo": - { - "configStatus": "readyForRelease", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" - }, - "possibleFromStates": - [ - { - "configStatus": "readyForRelease", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ], - "autoAction": - { - "configStatus": "hold", - "lockStatus": "unLocked" - } - }, - { - "stateTo": - { - "configStatus": "readyForRelease", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "*" - }, - "possibleFromStates": - [ - { - "configStatus": "hold", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" - }, - { - "configStatus": "hold", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ], - "autoAction": - { - "configStatus": "readyForRelease", - "lockStatus": "locked" - } - }, - { - "stateTo": - { - "configStatus": "readyForRelease", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - }, - "possibleFromStates": - [ - { - "configStatus": "readyForRelease", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ] - }, - { - "stateTo": - { - "configStatus": "readyForRelease", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" - }, - "possibleFromStates": - [ - { - "configStatus": "readyForRelease", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ], - "autoAction": - { - "configStatus": "hold", - "lockStatus": "unLocked" - } - }, - { - "stateTo": - { - "configStatus": "readyForRelease", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "*" - }, - "possibleFromStates": - [ - { - "configStatus": "hold", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" - }, - { - "configStatus": "hold", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ], - "autoAction": - { - "configStatus": "readyForRelease", - "lockStatus": "locked" - } - }, - { - "stateTo": - { - "configStatus": "hold", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - }, - "possibleFromStates": - [ - { - "configStatus": "readyForRelease", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - }, - { - "configStatus": "hold", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" - } - ] - }, - { - "stateTo": - { - "configStatus": "hold", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" - }, - "possibleFromStates": - [ - { - "configStatus": "hold", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ] - }, - { - "stateTo": - { - "configStatus": "hold", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - }, - "possibleFromStates": - [ - { - "configStatus": "readyForRelease", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - }, - { - "configStatus": "hold", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" - } - ] - }, - { - "stateTo": - { - "configStatus": "hold", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "unLocked" - }, - "possibleFromStates": - [ - { - "configStatus": "hold", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ] - }, - { - "stateTo": - { - "configStatus": "rescind", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "*" - }, - "possibleFromStates": - [ - { - "configStatus": "readyForRelease", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - }, - { - "configStatus": "hold", - "rolloutStatus": "completelyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ] - }, - { - "stateTo": - { - "configStatus": "rescind", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "*" - }, - "possibleFromStates": - [ - { - "configStatus": "readyForRelease", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - }, - { - "configStatus": "hold", - "rolloutStatus": "partiallyDeployed", - "dependencyArtifactStatus": "allImagesSelected", - "lockStatus": "locked" - } - ] - } - ], - "consequence": "BLOCK" -}', true, false, 1, now(),1,now()), - ('ReleaseActionCheckPolicy', 'RELEASE_ACTION_CHECK', 'V1', 'Policy used for validating different actions requested on release.', + '{ + "definitions": + [ + { + "stateTo": + { + "configStatus": "draft", + "dependencyArtifactStatus": "noImageSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + }, + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "noImageSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "locked" + } + ] + }, + { + "stateTo": + { + "configStatus": "draft", + "dependencyArtifactStatus": "noImageSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "locked" + }, + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "noImageSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + } + ] + }, + { + "stateTo": + { + "configStatus": "draft", + "dependencyArtifactStatus": "partialImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + }, + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "partialImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "locked" + } + ] + }, + { + "stateTo": + { + "configStatus": "draft", + "dependencyArtifactStatus": "partialImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "locked" + }, + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "partialImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + } + ] + }, + { + "stateTo": + { + "configStatus": "draft", + "dependencyArtifactStatus": "allImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "locked" + }, + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "allImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + }, + { + "configStatus": "readyForRelease", + "rolloutStatus": "notDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ] + }, + { + "stateTo": + { + "configStatus": "draft", + "dependencyArtifactStatus": "allImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + }, + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "allImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "locked" + }, + { + "configStatus": "draft", + "dependencyArtifactStatus": "noImageSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + }, + { + "configStatus": "draft", + "dependencyArtifactStatus": "partialImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + } + ] + }, + { + "stateTo": + { + "configStatus": "readyForRelease", + "rolloutStatus": "notDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" + }, + "possibleFromStates": + [ + { + "configStatus": "draft", + "dependencyArtifactStatus": "allImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "unLocked" + }, + { + "configStatus": "draft", + "dependencyArtifactStatus": "allImagesSelected", + "rolloutStatus": "notDeployed", + "lockStatus": "locked" + } + ], + "autoAction": + { + "configStatus": "readyForRelease", + "lockStatus": "locked" + } + }, + { + "stateTo": + { + "configStatus": "readyForRelease", + "rolloutStatus": "notDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "unLocked" + }, + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "rolloutStatus": "notDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ], + "autoAction": + { + "configStatus": "draft", + "lockStatus": "unLocked" + } + }, + { + "stateTo": + { + "configStatus": "readyForRelease", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + }, + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "rolloutStatus": "notDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ] + }, + { + "stateTo": + { + "configStatus": "readyForRelease", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "unLocked" + }, + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ], + "autoAction": + { + "configStatus": "hold", + "lockStatus": "unLocked" + } + }, + { + "stateTo": + { + "configStatus": "readyForRelease", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" + }, + "possibleFromStates": + [ + { + "configStatus": "hold", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "unLocked" + }, + { + "configStatus": "hold", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ], + "autoAction": + { + "configStatus": "readyForRelease", + "lockStatus": "locked" + } + }, + { + "stateTo": + { + "configStatus": "readyForRelease", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + }, + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ] + }, + { + "stateTo": + { + "configStatus": "readyForRelease", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "unLocked" + }, + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ], + "autoAction": + { + "configStatus": "hold", + "lockStatus": "unLocked" + } + }, + { + "stateTo": + { + "configStatus": "readyForRelease", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" + }, + "possibleFromStates": + [ + { + "configStatus": "hold", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "unLocked" + }, + { + "configStatus": "hold", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ], + "autoAction": + { + "configStatus": "readyForRelease", + "lockStatus": "locked" + } + }, + { + "stateTo": + { + "configStatus": "hold", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + }, + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + }, + { + "configStatus": "hold", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "unLocked" + } + ] + }, + { + "stateTo": + { + "configStatus": "hold", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "unLocked" + }, + "possibleFromStates": + [ + { + "configStatus": "hold", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ] + }, + { + "stateTo": + { + "configStatus": "hold", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + }, + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + }, + { + "configStatus": "hold", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "unLocked" + } + ] + }, + { + "stateTo": + { + "configStatus": "hold", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "unLocked" + }, + "possibleFromStates": + [ + { + "configStatus": "hold", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ] + }, + { + "stateTo": + { + "configStatus": "rescind", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" + }, + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + }, + { + "configStatus": "hold", + "rolloutStatus": "completelyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ] + }, + { + "stateTo": + { + "configStatus": "rescind", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "*" + }, + "possibleFromStates": + [ + { + "configStatus": "readyForRelease", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + }, + { + "configStatus": "hold", + "rolloutStatus": "partiallyDeployed", + "dependencyArtifactStatus": "allImagesSelected", + "lockStatus": "locked" + } + ] + } + ], + "consequence": "BLOCK" + }', true, false, 1, now(),1,now()), + ('ReleaseActionCheckPolicy', 'RELEASE_ACTION_CHECK', 'V1', 'Policy used for validating different actions requested on release.', '{ "definitions": [ From c0297dcbe201d3f6ff105ced517125dbb5bc65d0 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Tue, 7 May 2024 15:47:26 +0530 Subject: [PATCH 31/34] Added task run down migration --- scripts/sql/244_alter_resource_release_feature.down.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/sql/244_alter_resource_release_feature.down.sql b/scripts/sql/244_alter_resource_release_feature.down.sql index b3780c573f..f6e7c25375 100644 --- a/scripts/sql/244_alter_resource_release_feature.down.sql +++ b/scripts/sql/244_alter_resource_release_feature.down.sql @@ -1,3 +1,7 @@ +DROP TABLE "public"."devtron_resource_task_run"; + +DROP SEQUENCE IF EXISTS id_devtron_resource_task_run; + ALTER TABLE devtron_resource_object DROP COLUMN identifier; From aa3aba28fe47d89b7a3fdd73e38d90ab9c42f28f Mon Sep 17 00:00:00 2001 From: Shivam-nagar23 Date: Tue, 7 May 2024 16:24:04 +0530 Subject: [PATCH 32/34] sql script change --- scripts/sql/244_alter_resource_release_feature.up.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/sql/244_alter_resource_release_feature.up.sql b/scripts/sql/244_alter_resource_release_feature.up.sql index f1e98d4902..896a4f8f21 100644 --- a/scripts/sql/244_alter_resource_release_feature.up.sql +++ b/scripts/sql/244_alter_resource_release_feature.up.sql @@ -1445,6 +1445,7 @@ CREATE TABLE IF NOT EXISTS public.devtron_resource_task_run "task_json" jsonb NOT NULL , "run_source_identifier" varchar(500) NOT NULL, "run_source_dependency_identifier" varchar(500) NOT NULL, + "run_target_identifier" varchar(500) NOT NULL, "task_type" varchar(100) NOT NULL, "task_type_identifier" int NOT NULL, PRIMARY KEY ("id") From faceebee02ae12f8812bcdc35e0d440b9c76cfe6 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Thu, 9 May 2024 17:15:37 +0530 Subject: [PATCH 33/34] updated policy for action check - instruction patch --- scripts/sql/244_alter_resource_release_feature.up.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/sql/244_alter_resource_release_feature.up.sql b/scripts/sql/244_alter_resource_release_feature.up.sql index 896a4f8f21..40d92ae32e 100644 --- a/scripts/sql/244_alter_resource_release_feature.up.sql +++ b/scripts/sql/244_alter_resource_release_feature.up.sql @@ -1935,9 +1935,7 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "overview.name", "overview.metadata", "status.config.lock", - "status.config", - "dependency.applications.instruction" - ], + "status.config" ], "possibleFromStates": [ { @@ -1965,7 +1963,8 @@ VALUES('ReleaseStatusPolicy', 'RELEASE_STATUS', 'V1', 'Policy used for validatio "operationPaths": [ "dependency.applications", - "dependency.applications.image" + "dependency.applications.image", + "dependency.applications.instruction" ], "possibleFromStates": [ From 5358f4f9fa4ae4d66e659065cc142d209646d5fb Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Fri, 10 May 2024 14:00:36 +0530 Subject: [PATCH 34/34] fixed schema merge conflict --- scripts/sql/244_alter_resource_release_feature.up.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/sql/244_alter_resource_release_feature.up.sql b/scripts/sql/244_alter_resource_release_feature.up.sql index 40d92ae32e..8f6ad36f9d 100644 --- a/scripts/sql/244_alter_resource_release_feature.up.sql +++ b/scripts/sql/244_alter_resource_release_feature.up.sql @@ -210,7 +210,7 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "firstReleasedOn": { "type": "string", - "format": "date" + "format": "date-time" }, "releaseVersion": { @@ -436,7 +436,7 @@ VALUES ((select id from devtron_resource where kind = 'release-track'), 'alpha1' "firstReleasedOn": { "type": "string", - "format": "date" + "format": "date-time" }, "releaseVersion": {