From 56398f8029cd1435fb3a5bd3c2dcffdc04fa7c8d Mon Sep 17 00:00:00 2001 From: Spencer Sutton <suttonsp@amazon.com> Date: Mon, 19 Jul 2021 18:56:37 +0000 Subject: [PATCH] Adding sonar,dependency-check to aws commit 7e595c3c Author: Spencer Sutton <suttonsp@amazon.com> Date: Mon Jul 19 2021 11:49:17 GMT-0500 (Central Daylight Time) Fixing build commit a2ada905 Author: Spencer Sutton <suttonsp@amazon.com> Date: Mon Jul 19 2021 10:40:27 GMT-0500 (Central Daylight Time) Adding sonar,dependency-check to aws --- provider/notification-aws/build-aws/buildspec.yaml | 10 +++++++++- provider/notification-aws/maven/settings.xml | 11 +++++++++++ provider/notification-aws/pom.xml | 12 ++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/provider/notification-aws/build-aws/buildspec.yaml b/provider/notification-aws/build-aws/buildspec.yaml index e5fc2bd6e..6d134addb 100644 --- a/provider/notification-aws/build-aws/buildspec.yaml +++ b/provider/notification-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 -ntp -B test install -pl notification-core,provider/notification-aws -Ddeployment.environment=prod + - mvn -ntp -B test install sonar:sonar -pl .,notification-core,provider/notification-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/notification-test-aws/build-aws/prepare-dist.sh @@ -78,6 +83,9 @@ phases: python provider/notification-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/notification-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/notification-aws/maven/settings.xml b/provider/notification-aws/maven/settings.xml index 1bfc43ac9..3bd1cd4aa 100644 --- a/provider/notification-aws/maven/settings.xml +++ b/provider/notification-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/notification-aws/pom.xml b/provider/notification-aws/pom.xml index f2cf1a2f1..eadd46937 100644 --- a/provider/notification-aws/pom.xml +++ b/provider/notification-aws/pom.xml @@ -116,6 +116,18 @@ <failOnMissingWebXml>false</failOnMissingWebXml> </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> </project> -- GitLab