-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Adding Orca Security Image Scan Plugin #6154
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.plugin_version='1.0.0' and p.name='ORCA SECURITY SCAN' and p.deleted=false and ps."index"=1 and ps.deleted=false); | ||
DELETE FROM plugin_step WHERE plugin_id = (SELECT id FROM plugin_metadata WHERE plugin_version='1.0.0' and name='ORCA SECURITY SCAN' and deleted=false); | ||
DELETE FROM plugin_stage_mapping WHERE plugin_id =(SELECT id FROM plugin_metadata WHERE plugin_version='1.0.0' and name='ORCA SECURITY SCAN' and deleted=false); | ||
DELETE FROM pipeline_stage_step where ref_plugin_id in (SELECT id from plugin_metadata WHERE plugin_version='1.0.0' and name ='ORCA SECURITY SCAN' and deleted=false); | ||
DELETE from plugin_pipeline_script where id = (SELECT script_id from plugin_step WHERE plugin_id=(SELECT id FROM plugin_metadata WHERE plugin_version='1.0.0' and name='ORCA SECURITY SCAN' and deleted=false)); | ||
DELETE FROM plugin_metadata WHERE plugin_version='1.0.0' and name ='ORCA SECURITY SCAN' and deleted=false; | ||
DELETE FROM plugin_parent_metadata WHERE identifier ='security-image-scan'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
INSERT INTO "plugin_parent_metadata" ("id", "name","identifier", "description","type","icon","deleted", "created_on", "created_by", "updated_on", "updated_by") | ||
VALUES (nextval('id_seq_plugin_parent_metadata'), 'ORCA SECURITY IMAGE SCAN','orca-image-scan','Orca Cloud Security plugin for scanning container images and detecting vulnerabilities','PRESET','https://raw.githubusercontent.com/devtron-labs/devtron/main/assets/orca_security_scan_logo.png','f', 'now()', 1, 'now()', 1); | ||
|
||
|
||
UPDATE plugin_metadata SET is_latest = false WHERE id = (SELECT id FROM plugin_metadata WHERE name= 'ORCA SECURITY IMAGE SCAN' and is_latest= true); | ||
|
||
|
||
INSERT INTO "plugin_metadata" ("id", "name", "description","deleted", "created_on", "created_by", "updated_on", "updated_by","plugin_parent_metadata_id","plugin_version","is_deprecated","is_latest") | ||
VALUES (nextval('id_seq_plugin_metadata'), 'ORCA SECURITY SCAN','Plugin for scanning images and detecting vulnerabilities using Orca Cloud Security tool','f', 'now()', 1, 'now()', 1, (SELECT id FROM plugin_parent_metadata WHERE identifier='orca-image-scan'),'1.0.0', false, true); | ||
|
||
|
||
INSERT INTO "plugin_stage_mapping" ("plugin_id","stage_type","created_on", "created_by", "updated_on", "updated_by") | ||
VALUES ((SELECT id FROM plugin_metadata WHERE plugin_version='1.0.0' and name='ORCA SECURITY IMAGE SCAN' and deleted= false),3,'now()', 1, 'now()', 1); | ||
|
||
INSERT INTO "plugin_pipeline_script" ("id", "script","type","deleted","created_on", "created_by", "updated_on", "updated_by")VALUES ( | ||
nextval('id_seq_plugin_pipeline_script'), | ||
E'#!/bin/bash | ||
|
||
echo "Installing Orca CLI..." | ||
curl -sfL "https://raw.githubusercontent.com/orcasecurity/orca-cli/55c2742bb04c5a11f25e061a8e715cf6bc281a67/install.sh" | bash | ||
|
||
if ! command -v orca-cli &> /dev/null; then | ||
echo "Error: Orca CLI installation failed" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${ScanTimeout}" ]; then | ||
ScanTimeout="15m" | ||
echo "No timeout specified. Using default: 15 minutes." | ||
fi | ||
|
||
echo "Starting Orca image scan for ${ImageName}..." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add support for extraArgs as well if supported |
||
orca-cli -p "${ProjectKey}" image scan "${ImageName}" --api-token "${OrcaSecurityApiToken}" --timeout "${ScanTimeout}" | ||
echo "Orca image scan completed successfully" | ||
', | ||
'SHELL', | ||
'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 plugin_version='1.0.0' and name='ORCA SECURITY IMAGE SCAN' and deleted= false),'Step 1','Step 1 - Triggering ORCA SECURITY 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", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by","default_value") | ||
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.plugin_version='1.0.0' and p.name='ORCA SECURITY IMAGE SCAN' and p.deleted=false and ps."index"=1 and ps.deleted=false), 'ImageName','STRING','Provide the image that needs to be scanned',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1, null), | ||
(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.plugin_version='1.0.0' and p.name='ORCA SECURITY IMAGE SCAN' and p.deleted=false and ps."index"=1 and ps.deleted=false), 'ProjectKey','STRING','Name of the Project Key present in Orca Security platform',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1,null), | ||
(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.plugin_version='1.0.0' and p.name='ORCA SECURITY IMAGE SCAN' and p.deleted=false and ps."index"=1 and ps.deleted=false), 'OrcaSecurityApiToken','STRING','Orca API Token used for Authentication',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1, null), | ||
(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.plugin_version='1.0.0' and p.name='ORCA SECURITY IMAGE SCAN' and p.deleted=false and ps."index"=1 and ps.deleted=false), 'ScanTimeout','STRING','Maximum time allowed for the scan (e.g., ''10m'', ''1h'', default: ''15m'' )',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1, null); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of Hash, can we use tags here for install script?