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
6 changes: 3 additions & 3 deletions build-gradle/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ should_deploy() {

# Disable deployment when shadow scans are enabled to prevent duplicate artifacts
if [[ "${RUN_SHADOW_SCANS}" = "true" ]]; then
echo "Shadow scans enabled - disabling deployment" >&2
echo "::warning title=Deployment disabled::Shadow scans enabled - disabling deployment" >&2
return 1
fi

Expand Down Expand Up @@ -179,7 +179,7 @@ set_gradle_cmd() {
elif check_tool gradle --version; then
export GRADLE_CMD="gradle"
else
echo "Neither ./gradlew nor gradle command found!" >&2
echo "::error title=Gradle not found::Neither ./gradlew nor gradle command found!" >&2
exit 1
fi
}
Expand Down Expand Up @@ -253,7 +253,7 @@ export_built_artifacts() {
fi

if [[ -z "$artifacts" ]]; then
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories"
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories" >&2
echo "::endgroup::"
return 0
fi
Expand Down
6 changes: 3 additions & 3 deletions build-maven/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ git_fetch_unshallow() {

check_settings_xml() {
if [ ! -f "$HOME/.m2/settings.xml" ]; then
echo "::error title=Missing Maven settings.xml::Maven settings.xml file not found at $HOME/.m2/settings.xml"
echo "::error title=Missing Maven settings.xml::Maven settings.xml file not found at $HOME/.m2/settings.xml" >&2
exit 1
fi
}
Expand All @@ -120,7 +120,7 @@ should_deploy() {

# Disable deployment when shadow scans are enabled to prevent duplicate artifacts
if [[ "${RUN_SHADOW_SCANS}" = "true" ]]; then
echo "Shadow scans enabled - disabling deployment" >&2
echo "::warning title=Deployment disabled::Shadow scans enabled - disabling deployment" >&2
return 1
fi

Expand Down Expand Up @@ -245,7 +245,7 @@ export_built_artifacts() {
fi

if [[ -z "$artifacts" ]]; then
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories"
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories" >&2
echo "::endgroup::"
return 0
fi
Expand Down
2 changes: 1 addition & 1 deletion build-maven/deploy-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ for artifact in $INSTALLED_ARTIFACTS; do
elif [[ $artifact == "com/"* ]]; then
private_artifacts+=("$artifact")
else
echo "WARN: Unrecognized artifact path: $artifact" >&2
echo "::warning title=Unrecognized artifact::Unrecognized artifact path: $artifact" >&2
fi
done

Expand Down
2 changes: 1 addition & 1 deletion build-npm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export_built_artifacts() {
artifacts=$(/usr/bin/find .attestation-artifacts -name '*.tgz' -type f 2>/dev/null || true)

if [[ -z "$artifacts" ]]; then
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories"
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories" >&2
echo "::endgroup::"
return 0
fi
Expand Down
8 changes: 4 additions & 4 deletions build-poetry/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ set_sonar_platform_vars() {
return 0
;;
*)
echo "ERROR: Unknown sonar platform '$platform'. Expected: next, sqc-us, sqc-eu, or none" >&2
echo "::error title=Invalid Sonar platform::Unknown sonar platform '$platform'. Expected: next, sqc-us, sqc-eu, or none" >&2
return 1
;;
esac
Expand Down Expand Up @@ -166,7 +166,7 @@ set_project_version() {
local current_version release_version digit_count

if ! current_version=$(poetry version -s); then
echo "Could not get version from Poetry project ('poetry version -s')" >&2
echo "::error title=Invalid project version::Could not get version from Poetry project ('poetry version -s')" >&2
echo "$current_version" >&2
return 1
fi
Expand All @@ -180,7 +180,7 @@ set_project_version() {
fi
if [[ "$digit_count" -gt 3 && $release_version =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
release_version="${BASH_REMATCH[0]}"
echo "WARN: version was truncated to $release_version because it had more than 3 digits"
echo "::warning title=Version truncated::Version was truncated to $release_version because it had more than 3 digits" >&2
fi
release_version="$release_version.${BUILD_NUMBER}"

Expand Down Expand Up @@ -323,7 +323,7 @@ export_built_artifacts() {
artifacts=$(/usr/bin/find dist -type f \( -name '*.tar.gz' -o -name '*.whl' -o -name '*.json' \) 2>/dev/null || true)

if [[ -z "$artifacts" ]]; then
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories"
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories" >&2
echo "::endgroup::"
return 0
fi
Expand Down
10 changes: 5 additions & 5 deletions build-yarn/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ set_build_env() {

# Validate required files exist
if [ ! -f "package.json" ]; then
echo "ERROR: package.json file not found in current directory." >&2
echo "::error title=Missing package.json::package.json file not found in current directory." >&2
exit 1
fi
if [ ! -f "yarn.lock" ]; then
echo "ERROR: yarn.lock file not found. This is required for yarn --immutable installs." >&2
echo "::error title=Missing yarn.lock::yarn.lock file not found. This is required for yarn --immutable installs." >&2
exit 1
fi

Expand Down Expand Up @@ -114,7 +114,7 @@ set_project_version() {

current_version=$(jq -r .version "$PACKAGE_JSON")
if [ -z "${current_version}" ] || [ "${current_version}" == "null" ]; then
echo "Could not get version from ${PACKAGE_JSON}" >&2
echo "::error file=${PACKAGE_JSON},title=Invalid project version::Could not get version from ${PACKAGE_JSON}" >&2
exit 1
fi
export CURRENT_VERSION=$current_version
Expand All @@ -129,7 +129,7 @@ set_project_version() {
elif [[ "$digit_count" -eq 2 ]]; then
release_version="${release_version}.0"
elif [[ "$digit_count" -ne 3 ]]; then
echo "ERROR: Unsupported version '$current_version' with $digit_count digits. Expected 1-3 digits (e.g., '1', '1.2', or '1.2.3')." >&2
echo "::error file=${PACKAGE_JSON},title=Unsupported version format::Unsupported version '$current_version' with $digit_count digits. Expected 1-3 digits (e.g., '1', '1.2', or '1.2.3')." >&2
return 1
fi
release_version="${release_version}-${BUILD_NUMBER}"
Expand Down Expand Up @@ -322,7 +322,7 @@ export_built_artifacts() {
artifacts=$(/usr/bin/find "$PWD/.attestation-artifacts/" -name '*.tgz' -type f 2>/dev/null || true)

if [[ -z "$artifacts" ]]; then
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories"
echo "::warning title=No artifacts found::No artifacts found for attestation in build output directories" >&2
echo "::endgroup::"
return 0
fi
Expand Down
2 changes: 1 addition & 1 deletion cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ runs:
shell: bash
run: |
echo "::warning:: This action is deprecated and will be removed in future releases. " \
"Please migrate to using the SonarSource/gh-action_cache action directly."
"Please migrate to using the SonarSource/gh-action_cache action directly." >&2

- uses: SonarSource/gh-action_cache@v1
id: cache
Expand Down
5 changes: 3 additions & 2 deletions config-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ runs:
fromJSON(steps.secrets.outputs.vault).DEVELOCITY_TOKEN || '' }}
run: |
if [[ "${DEVELOCITY_ACCESS_KEY:-}" == "${{ steps.develocity-hostname.outputs.hostname }}=" ]]; then
echo "::warning title=Found invalid DEVELOCITY_ACCESS_KEY::DEVELOCITY_ACCESS_KEY should not be set manually in the environment."
echo "::warning title=Found invalid DEVELOCITY_ACCESS_KEY::DEVELOCITY_ACCESS_KEY should not be set manually" \
"in the environment." >&2
echo "[WARNING] DEVELOCITY_ACCESS_KEY is set in the environment with an empty token. This is a deprecated configuration." \
"The Develocity token is configured by config-gradle. Please remove external configuration of DEVELOCITY_ACCESS_KEY."
fi
Expand Down Expand Up @@ -195,7 +196,7 @@ runs:
shell: bash
run: |
echo "::warning title=Deactivating UseContainerSupport::The GitHub-hosted Ubuntu runners have an issue with Java's" \
"UseContainerSupport feature."
"UseContainerSupport feature." >&2
echo "JAVA_TOOL_OPTIONS=${JAVA_TOOL_OPTIONS:=-XX:-UseContainerSupport}" >> "$GITHUB_ENV"

- name: Set Config Gradle completed
Expand Down
4 changes: 2 additions & 2 deletions config-gradle/set_gradle_project_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set_gradle_cmd() {
elif check_tool gradle --version; then
export GRADLE_CMD="gradle"
else
echo "Neither ./gradlew nor gradle command found!" >&2
echo "::error title=Gradle not found::Neither ./gradlew nor gradle command found!" >&2
exit 1
fi
}
Expand All @@ -37,7 +37,7 @@ set_project_version() {
if ! current_version=$($GRADLE_CMD "${GRADLE_CMD_PARAMS[@]}" |grep 'version:' | cut -d ":" -f 2 | tr -d "[:space:]") || \
[[ -z "$current_version" || "$current_version" == "unspecified" ]]; then
current_version=$($GRADLE_CMD properties --no-scan --no-daemon --console plain 2>&1 || true)
echo -e "::error title=Gradle project version::Could not get valid version from Gradle properties\nERROR: $current_version"
printf "%s\n%s\n" "::error title=Gradle project version::Could not get valid version from Gradle properties" "ERROR: $current_version" >&2
return 1
fi

Expand Down
5 changes: 3 additions & 2 deletions config-maven/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ runs:
fromJSON(steps.secrets.outputs.vault).DEVELOCITY_TOKEN || '' }}
run: |
if [[ "${DEVELOCITY_ACCESS_KEY:-}" == "${{ steps.develocity-hostname.outputs.hostname }}=" ]]; then
echo "::warning title=Found invalid DEVELOCITY_ACCESS_KEY::DEVELOCITY_ACCESS_KEY should not be set manually in the environment."
echo "::warning title=Found invalid DEVELOCITY_ACCESS_KEY::DEVELOCITY_ACCESS_KEY should not be set manually" \
"in the environment." >&2
echo "[WARNING] DEVELOCITY_ACCESS_KEY is set in the environment with an empty token. This is a deprecated configuration." \
"The Develocity token is configured by config-maven. Please remove external configuration of DEVELOCITY_ACCESS_KEY."
fi
Expand Down Expand Up @@ -199,7 +200,7 @@ runs:
shell: bash
run: |
echo "::warning title=Deactivating UseContainerSupport::The GitHub-hosted Ubuntu runners have an issue with Java's" \
"UseContainerSupport feature."
"UseContainerSupport feature." >&2
echo "JAVA_TOOL_OPTIONS=${JAVA_TOOL_OPTIONS:=-XX:-UseContainerSupport}" >> "$GITHUB_ENV"

- name: Create mvn wrapper function with common Maven flags and set MAVEN_OPTS
Expand Down
4 changes: 2 additions & 2 deletions config-maven/set_maven_project_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ get_current_version() {
local expression="project.version"
if ! command mvn --quiet --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec 2>/dev/null \
-Dexec.executable="echo" -Dexec.args="\${$expression}"; then
echo "Failed to evaluate Maven expression '$expression'" >&2
echo "::error title=Maven expression evaluation failed::Failed to evaluate Maven expression '$expression'" >&2
command mvn --debug --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
-Dexec.executable="echo" -Dexec.args="\${$expression}"
return 1
Expand Down Expand Up @@ -56,7 +56,7 @@ set_project_version() {
elif [[ "$dots_count" -eq 1 ]]; then
release_version="${release_version}.0"
elif [[ "$dots_count" -ne 2 ]]; then
echo "::error file=pom.xml,title=Maven project version::Unsupported version '$current_version' with $((dots_count + 1)) digits."
echo "::error file=pom.xml,title=Maven project version::Unsupported version '$current_version' with $((dots_count + 1)) digits." >&2
return 1
fi
release_version="${release_version}.${BUILD_NUMBER}"
Expand Down
4 changes: 2 additions & 2 deletions config-npm/npm_set_project_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ check_version_format() {
local version="$1"
# Check if version follows semantic versioning pattern (X.Y.Z or X.Y.Z-something)
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
echo "WARN: Version '${version}' does not match semantic versioning format (e.g., '1.2.3' or '1.2.3-beta.1')." >&2
echo "::warning title=Non-standard version format::Version '${version}' does not match semantic versioning format (e.g., '1.2.3' or '1.2.3-beta.1')." >&2
fi
return 0
}
Expand All @@ -42,7 +42,7 @@ set_project_version() {
local current_version release_version digit_count
current_version=$(jq -r .version "$PACKAGE_JSON")
if [[ -z "${current_version}" ]] || [[ "${current_version}" == "null" ]]; then
echo "Could not get version from ${PACKAGE_JSON}" >&2
echo "::error file=${PACKAGE_JSON},title=Invalid project version::Could not get version from ${PACKAGE_JSON}" >&2
exit 1
fi
echo "current-version=$current_version" >> "$GITHUB_OUTPUT"
Expand Down
2 changes: 1 addition & 1 deletion get-build-number/get_build_number.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PROPERTIES_API_URL="repos/${GITHUB_REPOSITORY}/properties/values"
BUILD_NUMBER=$(gh api -H "$GH_API_VERSION_HEADER" "$PROPERTIES_API_URL" --jq '.[] | select(.property_name == "build_number") | .value')
echo "Current build number from repo: ${BUILD_NUMBER:=0}"
if ! [[ "$BUILD_NUMBER" =~ ^[0-9]+$ ]]; then
echo "Error: Build number '${BUILD_NUMBER}' is not a valid positive integer."
echo "::error title=Invalid build number::Build number '${BUILD_NUMBER}' is not a valid positive integer." >&2
exit 1
fi

Expand Down
4 changes: 2 additions & 2 deletions promote/promote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ check_branch() {
fi

if ! (is_pull_request || is_default_branch || is_maintenance_branch || is_dogfood_branch); then
echo "Promotion is only available for pull requests, main branch, maintenance branches, or dogfood branches." >&2
echo "::error title=Promotion unavailable::Promotion is only available for pull requests, main branch, maintenance branches, or dogfood branches." >&2
echo "Current branch: ${GITHUB_REF_NAME} (GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME})" >&2
return 1
fi
Expand Down Expand Up @@ -98,7 +98,7 @@ get_build_info_property() {
fi
property_value=$(jq -r ".buildInfo.properties.\"buildInfo.env.$property\"" "$BUILD_INFO_FILE")
if [[ "$property_value" == "null" || -z "$property_value" || "$property_value" == "unspecified" ]]; then
echo "Failed to retrieve $property from buildInfo for build ${BUILD_NAME}/${BUILD_NUMBER}" >&2
echo "::error title=Build info retrieval failed::Failed to retrieve $property from buildInfo for build ${BUILD_NAME}/${BUILD_NUMBER}" >&2
jq -r '.errors' "$BUILD_INFO_FILE" >&2
return 1
fi
Expand Down
4 changes: 2 additions & 2 deletions shared/common-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set_sonar_platform_vars() {
return 0
;;
*)
echo "ERROR: Invalid Sonar platform '$platform'. Must be one of: next, sqc-us, sqc-eu, none" >&2
echo "::error title=Invalid Sonar platform::Invalid Sonar platform '$platform'. Must be one of: next, sqc-us, sqc-eu, none" >&2
return 1
;;
esac
Expand Down Expand Up @@ -86,7 +86,7 @@ orchestrate_sonar_platforms() {
check_tool() {
# Check if a command is available and runs it, typically: 'some_tool --version'
if ! command -v "$1"; then
echo "$1 is not installed." >&2
echo "::error title=Missing tool::$1 is not installed." >&2
return 1
fi
"$@"
Expand Down
11 changes: 6 additions & 5 deletions spec/build-gradle_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Describe 'should_deploy'
When call should_deploy
The status should be failure
The lines of stderr should equal 1
The line 1 of stderr should equal "Shadow scans enabled - disabling deployment"
The line 1 of stderr should equal "::warning title=Deployment disabled::Shadow scans enabled - disabling deployment"
End
End

Expand Down Expand Up @@ -343,7 +343,7 @@ Describe 'gradle_build'
The output should include "Gradle command:"
The output should include "Gradle executed with:"
The output should not include "=== ORCHESTRATOR:"

The stderr should include "::warning title=No artifacts found::"

rm -f gradle-mock gradle.properties
End
Expand Down Expand Up @@ -454,17 +454,17 @@ Describe 'set_gradle_cmd()'
# Mock check_tool to fail for gradle
Mock check_tool
if [[ "$1" == "gradle" ]]; then
echo "gradle is not installed." >&2
echo "::error title=Missing tool::gradle is not installed." >&2
false
else
echo "$1 is not installed." >&2
echo "::error title=Missing tool::$1 is not installed." >&2
false
fi
End

When run set_gradle_cmd
The status should be failure
The stderr should include "Neither ./gradlew nor gradle command found!"
The stderr should include "::error title=Gradle not found::Neither ./gradlew nor gradle command found!"

rm -f ./gradlew
End
Expand Down Expand Up @@ -505,5 +505,6 @@ Describe 'script execution'
When run script build-gradle/build.sh
The status should be success
The output should include "PROJECT: my-repo"
The stderr should include "::warning title=No artifacts found::"
End
End
2 changes: 1 addition & 1 deletion spec/build-maven_deploy-artifacts_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ com/sonarsource/private/app/1.0/app-1.0.pom"

When run script build-maven/deploy-artifacts.sh
The status should be success
The stderr should include "WARN: Unrecognized artifact path: unknown/artifact/path.jar"
The stderr should include "::warning title=Unrecognized artifact::Unrecognized artifact path: unknown/artifact/path.jar"
The output should include "org/sonarsource/app/1.0/app-1.0.pom"
The output should include "com/sonarsource/private/app/1.0/app-1.0.pom"

Expand Down
Loading
Loading