diff --git a/provider/partition-aws/build-aws/buildspec.yaml b/provider/partition-aws/build-aws/buildspec.yaml index 788ce1a98c96e425fe1b8275dea51bb18a061a34..459686629f930b4dc925b45616db2cfb55678a30 100644 --- a/provider/partition-aws/build-aws/buildspec.yaml +++ b/provider/partition-aws/build-aws/buildspec.yaml @@ -21,6 +21,11 @@ env: secrets-manager: DOCKER_USERNAME: /osdu/devops/docker_credentials:username DOCKER_PASSWORD: /osdu/devops/docker_credentials:password + SONAR_USERNAME: /osdu/devops/sonar_credentials:username + SONAR_PASSWORD: /osdu/devops/sonar_credentials:password + + parameter-store: + SONAR_URL: /osdu/devops/sonar_url phases: install: @@ -58,7 +63,7 @@ phases: - printenv - echo "Building primary service assemblies..." - - mvn -B test install -pl partition-core,provider/partition-aws -Ddeployment.environment=prod + - mvn -B test install sonar:sonar -pl .,partition-core,provider/partition-aws -Ddeployment.environment=prod -Dsonar.login=${SONAR_USERNAME} -Dsonar.password=${SONAR_PASSWORD} -Dsonar.branch.name=${BRANCH_NAME} - echo "Building integration testing assemblies and gathering artifacts..." - ./testing/partition-test-aws/build-aws/prepare-dist.sh @@ -78,6 +83,9 @@ phases: python provider/partition-aws/build-aws/build-info.py --branch ${CODEBUILD_SOURCE_VERSION} --commit ${CODEBUILD_RESOLVED_SOURCE_VERSION} \ --buildid ${CODEBUILD_BUILD_ID} --buildnumber ${CODEBUILD_BUILD_NUMBER} --reponame ${REPO_NAME} --outdir ${OUTPUT_DIR} \ --artifact ${ECR_IMAGE} + post_build: + commands: + - cp provider/partition-aws/target/dependency-check-report.html ${OUTPUT_DIR} reports: SurefireReports: # CodeBuild will create a report group called "SurefireReports". files: #Store all of the files diff --git a/provider/partition-aws/maven/settings.xml b/provider/partition-aws/maven/settings.xml index 1bfc43ac96aafb6790498c6f0acef3ca0818a98f..3bd1cd4aa7ed183241e62e75d2b7f1a3f5ebc7aa 100644 --- a/provider/partition-aws/maven/settings.xml +++ b/provider/partition-aws/maven/settings.xml @@ -54,6 +54,17 @@ limitations under the License. <azure.devops.token>no-default</azure.devops.token> </properties> </profile> + <profile> + <id>sonar</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <sonar.host.url> + ${env.SONAR_URL} + </sonar.host.url> + </properties> + </profile> </profiles> <servers> diff --git a/provider/partition-aws/pom.xml b/provider/partition-aws/pom.xml index 48fcc328f3e49ac5f4ccdb910e26412fc519255a..0f75e5519a4fc2581735488c548c83c121e98a3a 100644 --- a/provider/partition-aws/pom.xml +++ b/provider/partition-aws/pom.xml @@ -180,6 +180,18 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.owasp</groupId> + <artifactId>dependency-check-maven</artifactId> + <version>6.2.2</version> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build>