Skip to content

Commit b319d19

Browse files
authored
Merge pull request #198 from MikelAlejoBR/RHCLOUD-39380-fix-sonarqube-main-branch
fix: SonarQube uses "main" instead of "master" to compare the code
2 parents 1f0f947 + e5996b2 commit b319d19

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

scripts/scanner/scan_code.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ cp --recursive "/repository" "${source_dir}"
2323
# Run the sonar scanner.
2424
#
2525
#
26-
# On the main branch there is no need to give the pull request details.
26+
# On the master branch there is no need to give the pull request details.
2727
#
28-
if [ -n "${GIT_BRANCH:-}" ] && { [ "${GIT_BRANCH}" == "main" ] || [ "${GIT_BRANCH}" == "origin/main" ]; }; then
28+
if [ -n "${GIT_BRANCH:-}" ] && { [ "${GIT_BRANCH}" == "master" ] || [ "${GIT_BRANCH}" == "origin/master" ]; }; then
2929
sonar-scanner \
3030
-Dsonar.exclusions="**/*.sql" \
3131
-Dsonar.host.url="${SONARQUBE_HOST_URL}" \
@@ -42,7 +42,7 @@ else
4242
-Dsonar.projectBaseDir="${source_dir}/repository" \
4343
-Dsonar.projectKey="${SONARQUBE_PROJECT_KEY}" \
4444
-Dsonar.projectVersion="${COMMIT_SHORT}" \
45-
-Dsonar.pullrequest.base="main" \
45+
-Dsonar.pullrequest.base="master" \
4646
-Dsonar.pullrequest.branch="${GIT_BRANCH}" \
4747
-Dsonar.pullrequest.key="${GITHUB_PULL_REQUEST_ID}" \
4848
-Dsonar.sourceEncoding="UTF-8" \

scripts/sonarqube.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ readonly project_key
3232
# Run the Sonar Scanner in a container. The "repository" directory is just the
3333
# source code, and we mount it to be able to scan the source code.
3434
#
35-
# Should we be running on main, then skip passing the information regarding the
36-
# pull request.
35+
# Should we be running on master, then skip passing the information regarding
36+
# the pull request.
3737
#
3838
# Finally, the volume is mounted with the "z" option, because it seems like
3939
# the runner has SELinux activated, and that we need to relabel the directory
4040
# to have permission to read it. More information here: https://www.reddit.com/r/podman/comments/fww87v/permission_denied_within_mounted_volume_inside/
4141
#
42-
if [ -n "${GIT_BRANCH:-}" ] && [ "${GIT_BRANCH}" == "origin/main" ]; then
42+
if [ -n "${GIT_BRANCH:-}" ] && { [ "${GIT_BRANCH}" == "master" ] || [ "${GIT_BRANCH}" == "origin/master" ]; }; then
4343
podman run \
4444
--env COMMIT_SHORT="${commit_short}" \
4545
--env GIT_BRANCH="${GIT_BRANCH}" \

0 commit comments

Comments
 (0)