Skip to content

Commit fc2ae44

Browse files
committed
SONARXML-252 Use a standard code for: Unify Platform Dogfooding
1 parent 3e065b6 commit fc2ae44

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

.cirrus.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ env:
1414
ARTIFACTORY_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
1515
DEVELOCITY_TOKEN: VAULT[development/kv/data/develocity data.token]
1616
DEVELOCITY_ACCESS_KEY: develocity.sonar.build=${DEVELOCITY_TOKEN}
17-
SONAR_PROJECT_KEY: "org.sonarsource.xml:xml"
1817
# Use bash (instead of sh on linux or cmd.exe on windows)
1918
CIRRUS_SHELL: bash
2019

@@ -70,12 +69,13 @@ sonar_shadow_scan_and_issue_replication_task:
7069
depends_on:
7170
- build
7271
# Only run when triggered by the cirrus-ci cron job named "nightly"
73-
only_if: $CIRRUS_CRON == "nightly"
72+
# TODO only_if: $CIRRUS_CRON == "nightly"
7473
eks_container:
7574
<<: *CONTAINER_DEFINITION
7675
cpu: 2
7776
memory: 2G
7877
env:
78+
SONAR_PROJECT_KEY: "org.sonarsource.xml:xml"
7979
SHADOW_ORGANIZATION: "sonarsource"
8080
SHADOW_PROJECT_KEY: "SonarSource_sonar-xml"
8181
# to replicate issue states from next
@@ -90,8 +90,9 @@ sonar_shadow_scan_and_issue_replication_task:
9090
SHADOW_SONAR_HOST_URL: "https://sonarqube.us"
9191
maven_cache:
9292
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
93-
build_script:
93+
build_and_shadow_scan_script:
9494
- *log_develocity_url_script
95+
- source cirrus-env BUILD
9596
- ./shadow-scan-and-issue-replication.sh
9697
cleanup_before_cache_script: cleanup_maven_repository
9798

shadow-scan-and-issue-replication.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,22 @@ IRIS_JAR_PATH="target/libs/iris.jar"
99
function build_and_analyze_the_project() {
1010
echo
1111
echo "===== Build and analyze the project targeting a shadow SonarQube instance"
12-
mvn \
13-
-Pcoverage \
14-
-Dmaven.test.redirectTestOutputToFile=false \
12+
local BUILD_CMD
13+
if [[ -e "settings.gradle" ]]; then
14+
BUILD_CMD="./gradlew --info --stacktrace --console plain build sonar"
15+
else
16+
source set_maven_build_version "$BUILD_NUMBER"
17+
BUILD_CMD="mvn -Pcoverage -Dmaven.test.redirectTestOutputToFile=false --batch-mode --errors --show-version verify sonar:sonar"
18+
fi
19+
${BUILD_CMD} \
20+
-DbuildNumber="${BUILD_NUMBER}" \
1521
-Dsonar.host.url="${SHADOW_SONAR_HOST_URL}" \
1622
-Dsonar.token="${SHADOW_SONAR_TOKEN}" \
1723
-Dsonar.organization="${SHADOW_ORGANIZATION}" \
1824
-Dsonar.projectKey="${SHADOW_PROJECT_KEY}" \
1925
-Dsonar.analysis.buildNumber="${BUILD_NUMBER}" \
2026
-Dsonar.analysis.repository="${GITHUB_REPO}" \
21-
--batch-mode --errors --show-version \
22-
verify sonar:sonar
27+
"$@"
2328
}
2429

2530
function download_iris() {
@@ -63,8 +68,6 @@ function run_iris_with_and_without_dry_run() {
6368
fi
6469
}
6570

66-
source cirrus-env BUILD
67-
. set_maven_build_version "$BUILD_NUMBER"
68-
build_and_analyze_the_project
71+
build_and_analyze_the_project "$@"
6972
download_iris
7073
run_iris_with_and_without_dry_run

0 commit comments

Comments
 (0)