Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions build-maven/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,16 @@ build_maven() {

if is_default_branch || is_maintenance_branch; then
echo "======= Build and analyze $GITHUB_REF_NAME ======="
maven_command_args+=("-Prelease,sign")
if [[ "${RUN_SHADOW_SCANS}" != "true" ]]; then
maven_command_args+=("-Prelease,sign")
fi
elif is_pull_request; then
echo "======= Build and analyze pull request $PULL_REQUEST ($GITHUB_HEAD_REF) ======="
elif is_dogfood_branch; then
echo "======= Build dogfood branch $GITHUB_REF_NAME ======="
maven_command_args+=("-Prelease")
if [[ "${RUN_SHADOW_SCANS}" != "true" ]]; then
maven_command_args+=("-Prelease")
fi
elif is_long_lived_feature_branch; then
echo "======= Build and analyze long lived feature branch $GITHUB_REF_NAME ======="
else
Expand Down
22 changes: 22 additions & 0 deletions spec/build-maven_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,28 @@ Describe 'build_maven()'
The output should include "Maven command: mvn install"
The output should not include "Maven command: mvn deploy"
End

It 'excludes release and sign profiles when shadow scans are enabled'
When call build_maven
The status should be success
The stderr should include "Shadow scans enabled - disabling deployment"
The output should include "Maven command: mvn install -Pcoverage"
The output should not include "release"
The output should not include "sign"
Comment on lines +503 to +505
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The negative assertions are very broad ("release"/"sign" could match unrelated output like a branch name or future log text). To make the test more robust and specifically verify the behavior change, assert that the Maven command line does not contain the profile flags (e.g., "-Prelease,sign" / "-Prelease" / "-Psign") rather than the generic substrings.

Copilot uses AI. Check for mistakes.
End
End

Describe 'dogfood branch with shadow scans'
export GITHUB_REF_NAME="dogfood-on-next"
export RUN_SHADOW_SCANS="true"

It 'excludes release profile when shadow scans are enabled'
When call build_maven
The status should be success
The stderr should include "Shadow scans enabled - disabling deployment"
The output should include "Maven command: mvn install"
The output should not include "release"
Comment on lines +517 to +518
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion checks for the substring "release" anywhere in output, which is looser than needed and may become flaky if other log lines/branch names include that word. Prefer asserting the Maven command does not include the profile flag (e.g., "-Prelease").

Copilot uses AI. Check for mistakes.
End
End

Describe 'scan depends on the sonar platform and branch'
Expand Down
Loading