-
Notifications
You must be signed in to change notification settings - Fork 1
BUILD-10586 Fix inconsistencies between actions inputs, outputs and behaviors #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| # - SQC_EU_URL: URL of SonarQube server for sqc-eu platform | ||
| # - SQC_EU_TOKEN: Access token to send analysis reports to SonarQube for sqc-eu platform | ||
| # - RUN_SHADOW_SCANS: If true, run sonar scanner on all 3 platforms. If false, run on the platform provided by SONAR_PLATFORM. | ||
| # When enabled, SONAR_PLATFORM is ignored. | ||
| # - CURRENT_VERSION: Current project version as in gradle.properties | ||
| # - ARTIFACTORY_ACCESS_TOKEN: Access token to read Repox repositories | ||
| # - ARTIFACTORY_DEPLOY_REPO: Name of deployment repository | ||
|
|
@@ -48,25 +49,18 @@ set -euo pipefail | |
| # shellcheck source=../shared/common-functions.sh | ||
| source "$(dirname "${BASH_SOURCE[0]}")/../shared/common-functions.sh" | ||
|
|
||
| : "${ARTIFACTORY_ACCESS_TOKEN:?}" | ||
| : "${ARTIFACTORY_DEPLOY_REPO:?}" | ||
| : "${DEPLOY:=true}" | ||
| : "${ARTIFACTORY_ACCESS_TOKEN:?}" "${ARTIFACTORY_DEPLOY_REPO:?}" "${DEPLOY:=true}" "${DEPLOY_PULL_REQUEST:=false}" "${RUN_SHADOW_SCANS:?}" | ||
| : "${GITHUB_REF_NAME:?}" "${BUILD_NUMBER:?}" "${GITHUB_RUN_ID:?}" "${GITHUB_REPOSITORY:?}" "${GITHUB_EVENT_NAME:?}" "${GITHUB_SHA:?}" | ||
| : "${GITHUB_OUTPUT:?}" | ||
| : "${PULL_REQUEST?}" "${DEFAULT_BRANCH:?}" | ||
| : "${RUN_SHADOW_SCANS:?}" | ||
| : "${GITHUB_OUTPUT:?}" "${PULL_REQUEST?}" "${DEFAULT_BRANCH:?}" "${CURRENT_VERSION:?}" | ||
| if [[ "$DEPLOY" != "false" && "$RUN_SHADOW_SCANS" != "true" ]]; then | ||
| : "${ARTIFACTORY_DEPLOY_USERNAME:?}" "${ARTIFACTORY_DEPLOY_ACCESS_TOKEN:?}" | ||
| fi | ||
| : "${CURRENT_VERSION:?}" | ||
| if [[ "${SONAR_PLATFORM:?}" != "none" ]]; then | ||
| : "${NEXT_URL:?}" "${NEXT_TOKEN:?}" "${SQC_US_URL:?}" "${SQC_US_TOKEN:?}" "${SQC_EU_URL:?}" "${SQC_EU_TOKEN:?}" | ||
| fi | ||
| : "${ORG_GRADLE_PROJECT_signingKey:?}" "${ORG_GRADLE_PROJECT_signingPassword:?}" "${ORG_GRADLE_PROJECT_signingKeyId:?}" | ||
| : "${DEPLOY_PULL_REQUEST:=false}" | ||
| export DEPLOY_PULL_REQUEST | ||
| : "${SKIP_TESTS:=false}" | ||
| : "${GRADLE_ARGS:=}" | ||
| : "${SKIP_TESTS:=false}" "${GRADLE_ARGS:=}" | ||
| export DEPLOY DEPLOY_PULL_REQUEST SKIP_TESTS GRADLE_ARGS | ||
|
|
||
| git_fetch_unshallow() { | ||
| if [ "$SONAR_PLATFORM" = "none" ]; then | ||
|
|
@@ -112,6 +106,14 @@ should_deploy() { | |
| fi | ||
| } | ||
|
|
||
| should_scan() { | ||
| if [[ "$SONAR_PLATFORM" = "none" ]]; then | ||
| return 1 | ||
| fi | ||
| is_default_branch || is_maintenance_branch || is_pull_request || is_long_lived_feature_branch | ||
| return $? | ||
| } | ||
|
Comment on lines
+109
to
+115
|
||
|
|
||
| build_gradle_args() { | ||
| local args=() | ||
|
|
||
|
|
@@ -216,19 +218,15 @@ gradle_build() { | |
| echo "Sonar Platform: ${SONAR_PLATFORM}" | ||
| echo "Run Shadow Scans: ${RUN_SHADOW_SCANS}" | ||
|
|
||
| if [[ "$SONAR_PLATFORM" == "none" ]]; then | ||
| if should_scan; then | ||
| # Build with sonar analysis via orchestrator | ||
| # shellcheck disable=SC2119 | ||
| orchestrate_sonar_platforms | ||
| else | ||
| # Build without sonar - call gradle_build_and_analyze directly | ||
| echo "::group::Gradle build" | ||
| gradle_build_and_analyze | ||
| echo "::endgroup::" | ||
| else | ||
| # Build with sonar analysis via orchestrator | ||
| # TODO BUILD-10586: sonar analysis is not filtered by branch type here — it runs on all branches | ||
| # (including dogfood and other branches) when sonar-platform != none. This differs from | ||
| # build-maven/build-npm/build-yarn/build-poetry which skip sonar on dogfood/other branches. | ||
| # Should add a should_scan() guard consistent with the other build scripts. | ||
| # shellcheck disable=SC2119 | ||
| orchestrate_sonar_platforms | ||
| fi | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description says that when run-shadow-scans is enabled, the sonar-platform setting is ignored. However, the Vault secrets block only fetches NEXT_/SQC_ values when sonar-platform != 'none', so setting sonar-platform: 'none' with run-shadow-scans: 'true' would provide empty credentials and likely fail later. Consider either tightening the description/validation (disallow this combination) or updating the secrets/validation logic so shadow scans still fetch and validate the required sonar credentials.