Skip to content
Open
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
12 changes: 9 additions & 3 deletions scripts/sql/106_sonarqube_plugin_polling.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,25 @@ VALUES(nextval('id_seq_plugin_step_variable'),2,'CheckForSonarAnalysisReport','B
INSERT INTO plugin_step_variable (id,plugin_step_id,name,format,description,is_exposed,allow_empty_value,default_value,value,variable_type,value_type,previous_step_index,variable_step_index,variable_step_index_in_plugin,reference_variable_name,deleted,created_on,created_by,updated_on,updated_by)
VALUES(nextval('id_seq_plugin_step_variable'),2,'AbortPipelineOnPolicyCheckFailed','BOOL','Boolean value - true or false. Set true to abort on report check failed.','t','f',false,null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1);

INSERT INTO plugin_step_variable (id,plugin_step_id,name,format,description,is_exposed,allow_empty_value,default_value,value,variable_type,value_type,previous_step_index,variable_step_index,variable_step_index_in_plugin,reference_variable_name,deleted,created_on,created_by,updated_on,updated_by)
VALUES(nextval('id_seq_plugin_step_variable'),2,'SonarqubeExtraArgs','STRING','Define additional Sonar analysis parameters, each on a new line.','t','t',null,null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1);


UPDATE plugin_pipeline_script SET script=E'PathToCodeDir=/devtroncd$CheckoutPath
cd $PathToCodeDir
if [[ -z "$UsePropertiesFileFromProject" || $UsePropertiesFileFromProject == false ]]
then
echo "sonar.projectKey=$SonarqubeProjectKey" > sonar-project.properties
else
echo "sonar.projectKey=$GlobalSonarqubeProjectName" > sonar-project.properties
echo "$SonarqubeExtraArgs" >> sonar-project.properties
fi
docker run \\
--rm \\
-e SONAR_HOST_URL=$SonarqubeEndpoint \\
-e SONAR_LOGIN=$SonarqubeApiKey \\
-e SONAR_TOKEN=$SonarqubeApiKey \\
-v "/$PWD:/usr/src" \\
sonarsource/sonar-scanner-cli
sonarsource/sonar-scanner-cli:5.0.1

if [[ $CheckForSonarAnalysisReport == true && ! -z "$CheckForSonarAnalysisReport" ]]
then
Expand All @@ -42,4 +48,4 @@ then
then
echo "********* SonarQube Policy Passed *********"
fi
fi' WHERE id=2;
fi' WHERE id=2;
11 changes: 7 additions & 4 deletions scripts/sql/200_sonarqube_v1_1_0.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ VALUES (
# Define sonarqube scan function
SonarqubeScanFunction() {
echo -e "\n********** Starting the scanning ************"
docker run --rm -e SONAR_HOST_URL=$SonarqubeEndpoint -e SONAR_LOGIN=$SonarqubeApiKey -v "/$PWD:/usr/src" sonarsource/sonar-scanner-cli
docker run --rm -e SONAR_HOST_URL=$SonarqubeEndpoint -e SONAR_TOKEN=$SonarqubeApiKey -v "/$PWD:/usr/src" sonarsource/sonar-scanner-cli:5.0.1
SonarScanStatusCode=$?
echo -e "\nStatus code of sonarqube scanning command : $SonarScanStatusCode"
if [ "$SonarScanStatusCode" -ne 0 ]; then
Expand Down Expand Up @@ -96,6 +96,9 @@ VALUES (
if [[ -z "$UsePropertiesFileFromProject" || $UsePropertiesFileFromProject == false ]]
then
echo "sonar.projectKey=$GlobalSonarqubeProjectName" > sonar-project.properties
else
echo "sonar.projectKey=$GlobalSonarqubeProjectName" > sonar-project.properties
echo "$SonarqubeExtraArgs" >> sonar-project.properties
fi
echo -e "\n********** Sonarqube Project Name : $GlobalSonarqubeProjectName , Sonarqube Branch name : $SonarqubeBranchName ***********"
if [ -z "$GlobalSonarqubeProjectName" ] || [ -z "$SonarqubeBranchName" ]; then
Expand Down Expand Up @@ -145,8 +148,8 @@ VALUES (nextval('id_seq_plugin_step_variable'),(SELECT ps.id FROM plugin_metadat
(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='Sonarqube v1.1.0' and ps."index"=1 and ps.deleted=false),'TotalSonarqubeIssues','STRING','Total issues in the scanned code result from the sum of vulnerabilities and high hotspots','t','f',false,null,'OUTPUT','NEW',null,1,null,null,'f','now()',1,'now()',1),
(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='Sonarqube v1.1.0' and ps."index"=1 and ps.deleted=false),'SonarqubeHighHotspots','STRING','Total number of SonarQube hotspots (HIGH) in the source code','t','f',false,null,'OUTPUT','NEW',null,1,null,null,'f','now()',1,'now()',1),
(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='Sonarqube v1.1.0' and ps."index"=1 and ps.deleted=false),'SonarqubeProjectStatus','STRING','Quality gate status of Sonarqube Project ,it may be "ERROR","OK" ,"NONE"','t','f',false,null,'OUTPUT','NEW',null,1,null,null,'f','now()',1,'now()',1),
(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='Sonarqube v1.1.0' and ps."index"=1 and ps.deleted=false),'SonarqubeVulnerabilities','STRING','Total number of SonarQube vulnerabilities in the source code','t','f',false,null,'OUTPUT','NEW',null,1,null,null,'f','now()',1,'now()',1);

(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='Sonarqube v1.1.0' and ps."index"=1 and ps.deleted=false),'SonarqubeVulnerabilities','STRING','Total number of SonarQube vulnerabilities in the source code','t','f',false,null,'OUTPUT','NEW',null,1,null,null,'f','now()',1,'now()',1),
(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='Sonarqube v1.1.0' and ps."index"=1 and ps.deleted=false),'SonarqubeExtraArgs','STRING','Define additional Sonar analysis parameters, each on a new line.','t','t',null,null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1);

INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value","value","variable_type", "value_type", "variable_step_index",reference_variable_name, "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='Sonarqube v1.1.0' and ps."index"=1 and ps.deleted=false), 'GIT_MATERIAL_REQUEST','STRING','git material data',false,true,3,'INPUT','GLOBAL',1 ,'GIT_MATERIAL_REQUEST','f','now()', 1, 'now()', 1);
Expand All @@ -155,4 +158,4 @@ INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "d

INSERT INTO plugin_stage_mapping (id,plugin_id,stage_type,created_on,created_by,updated_on,updated_by)VALUES (nextval('id_seq_plugin_stage_mapping'),

(SELECT id from plugin_metadata where name='Sonarqube v1.1.0'), 0,'now()',1,'now()',1);
(SELECT id from plugin_metadata where name='Sonarqube v1.1.0'), 0,'now()',1,'now()',1);
8 changes: 8 additions & 0 deletions scripts/sql/260_sonarqube_v1_2_0.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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='Sonarqube v1.2.0' and ps."index"=1 and ps.deleted=false);
DELETE FROM plugin_step WHERE plugin_id = (SELECT id FROM plugin_metadata WHERE name='Sonarqube v1.2.0');
DELETE FROM plugin_stage_mapping WHERE plugin_id = (SELECT id FROM plugin_metadata WHERE name='Sonarqube v1.2.0');
DELETE from pipeline_stage_step_variable where pipeline_stage_step_id =(select pipeline_stage_id from pipeline_stage_step where name='Sonarqube v1.2.0');
DELETE FROM pipeline_stage_step_variable WHERE pipeline_stage_step_id = (SELECT id FROM pipeline_stage_step WHERE name='Sonarqube v1.2.0');
DELETE from pipeline_stage_step where name ='Sonarqube v1.2.0';
DELETE from plugin_tag_relation where plugin_id = (SELECT id FROM plugin_metadata WHERE name='Sonarqube v1.2.0');
DELETE FROM plugin_metadata WHERE name ='Sonarqube v1.2.0';
Loading