Skip to content

Commit

Permalink
Hotfix related to #2379. The sonar.newCode.referenceBranch and sonar.…
Browse files Browse the repository at this point in the history
…branch.name cannot be set to the same string! Only add the newCode definition when they differ.
  • Loading branch information
JohnHalleyGotway committed Apr 2, 2024
1 parent 2c72a1b commit a72e8c5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
10 changes: 10 additions & 0 deletions internal/scripts/docker/build_met_sonarqube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \
-e "s|SONAR_REFERENCE_BRANCH|$SONAR_REFERENCE_BRANCH|" \
$SONAR_PROPERTIES_DIR/python.sonar-project.properties > $SONAR_PROPERTIES

# The source and reference branches must differ to define new code
if [ "$MET_GIT_NAME" != "$SONAR_REFERENCE_BRANCH" ]; then
echo "sonar.newCode.referenceBranch=${SONAR_REFERENCE_BRANCH}" >> $SONAR_PROPERTIES
fi

# Run SonarQube scan for Python code
time_command $SONAR_SCANNER

Expand All @@ -112,6 +117,11 @@ sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \
-e "s|SONAR_REFERENCE_BRANCH|$SONAR_REFERENCE_BRANCH|" \
$SONAR_PROPERTIES_DIR/sonar-project.properties > $SONAR_PROPERTIES

# The source and reference branches must differ to define new code
if [ "$MET_GIT_NAME" != "$SONAR_REFERENCE_BRANCH" ]; then
echo "sonar.newCode.referenceBranch=${SONAR_REFERENCE_BRANCH}" >> $SONAR_PROPERTIES
fi

# Run the configure script
time_command ./configure \
BUFRLIB_NAME=${BUFRLIB_NAME} \
Expand Down
1 change: 0 additions & 1 deletion internal/scripts/sonarqube/python.sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ sonar.host.url=SONAR_HOST_URL

sonar.token=SONAR_TOKEN
sonar.branch.name=SONAR_BRANCH_NAME
sonar.newCode.referenceBranch=SONAR_REFERENCE_BRANCH
2 changes: 0 additions & 2 deletions internal/scripts/sonarqube/run_sonarqube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ else
-e "s|SONAR_PROJECT_KEY|MET_python_NB|" \
-e "s|SONAR_PROJECT_NAME|MET python Nightly Build|" \
-e "s|SONAR_BRANCH_NAME|develop|" \
-e "s|SONAR_REFERENCE_BRANCH|develop|" \
$SCRIPT_DIR/python.sonar-project.properties > $SONAR_PROPERTIES

# Run SonarQube scan for Python code
Expand All @@ -143,7 +142,6 @@ else
-e "s|SONAR_PROJECT_KEY|MET_develop_NB|" \
-e "s|SONAR_PROJECT_NAME|MET Nightly Build|" \
-e "s|SONAR_BRANCH_NAME|develop|" \
-e "s|SONAR_REFERENCE_BRANCH|develop|" \
$SCRIPT_DIR/sonar-project.properties > $SONAR_PROPERTIES

# Run SonarQube clean
Expand Down
1 change: 0 additions & 1 deletion internal/scripts/sonarqube/sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ sonar.host.url=SONAR_HOST_URL

sonar.token=SONAR_TOKEN
sonar.branch.name=SONAR_BRANCH_NAME
sonar.newCode.referenceBranch=SONAR_REFERENCE_BRANCH

0 comments on commit a72e8c5

Please sign in to comment.