diff --git a/provider/legal-aws/build-aws/buildspec.yaml b/provider/legal-aws/build-aws/buildspec.yaml index e4071081c1c4481a49bd54f6e40c12e01b657b04..731961d497f3c6f072a69579f85e8bf07467fd93 100644 --- a/provider/legal-aws/build-aws/buildspec.yaml +++ b/provider/legal-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: @@ -60,7 +65,7 @@ phases: - printenv - echo "Building primary service assemblies..." - - mvn -ntp -B test install -pl legal-core,provider/legal-aws -Ddeployment.environment=prod + - mvn -ntp -B test install sonar:sonar -pl .,legal-core,provider/legal-aws -Ddeployment.environment=prod -Dsonar.login=${SONAR_USERNAME} -Dsonar.password=${SONAR_PASSWORD} -Dsonar.branch.name=${BRANCH_NAME} # Suspended until further notice # - echo "Copying assemblies to dist..." @@ -85,6 +90,9 @@ phases: python provider/legal-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/legal-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/legal-aws/maven/settings.xml b/provider/legal-aws/maven/settings.xml index 7a6c05029421b0b3d5f66b77b4a38ea57a72bdfb..2236ea5de89bdee61b20327c1bf9eb27d4274eed 100644 --- a/provider/legal-aws/maven/settings.xml +++ b/provider/legal-aws/maven/settings.xml @@ -53,6 +53,17 @@ <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/legal-aws/pom.xml b/provider/legal-aws/pom.xml index ceb55521161bbb2280894849c566fa42f9a28678..51c7dcd03e8878ec509dfe6ae184128855989f2d 100644 --- a/provider/legal-aws/pom.xml +++ b/provider/legal-aws/pom.xml @@ -160,6 +160,18 @@ <threadCount>1</threadCount> </configuration> </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>