Skip to content

Commit 80ba8f3

Browse files
committed
fix: Errors should be written to stderr
1 parent ca7b81a commit 80ba8f3

14 files changed

Lines changed: 42 additions & 42 deletions

.github/scripts/release/create-archives.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function main {
99
local -r bin_dir="${1:-bin}"
1010

1111
if [[ ! -d "$bin_dir" ]]; then
12-
echo "ERROR: Directory $bin_dir does not exist"
12+
echo "ERROR: Directory $bin_dir does not exist" >&2
1313
exit 1
1414
fi
1515

.github/scripts/release/generate-checksums.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function main {
99
local -r bin_dir="${1:-bin}"
1010

1111
if [[ ! -d "$bin_dir" ]]; then
12-
echo "ERROR: Directory $bin_dir does not exist"
12+
echo "ERROR: Directory $bin_dir does not exist" >&2
1313
exit 1
1414
fi
1515

.github/scripts/release/install-gon.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,58 +17,58 @@ function main {
1717

1818
echo "Downloading gon from: $download_url"
1919
if ! curl -L -o gon.zip "$download_url"; then
20-
echo "ERROR: Failed to download gon from $download_url"
20+
echo "ERROR: Failed to download gon from $download_url" >&2
2121
rm -f gon.zip
2222
exit 1
2323
fi
2424

2525
# Extract to specific target
2626
echo "Extracting gon binary..."
2727
if ! unzip -o gon.zip -d . gon; then
28-
echo "ERROR: Failed to extract gon from gon.zip"
28+
echo "ERROR: Failed to extract gon from gon.zip" >&2
2929
rm -f gon.zip
3030
exit 1
3131
fi
3232

3333
# Verify extracted binary exists and is a regular file
3434
if [[ ! -f ./gon ]]; then
35-
echo "ERROR: Expected file './gon' not found after extraction"
35+
echo "ERROR: Expected file './gon' not found after extraction" >&2
3636
rm -f gon.zip
3737
exit 1
3838
fi
3939

4040
# Make executable
4141
echo "Setting executable permissions..."
4242
if ! chmod +x ./gon; then
43-
echo "ERROR: Failed to set executable permissions on ./gon"
43+
echo "ERROR: Failed to set executable permissions on ./gon" >&2
4444
rm -f gon.zip ./gon
4545
exit 1
4646
fi
4747

4848
# Verify it's executable
4949
if [[ ! -x ./gon ]]; then
50-
echo "ERROR: File ./gon is not executable after chmod"
50+
echo "ERROR: File ./gon is not executable after chmod" >&2
5151
rm -f gon.zip ./gon
5252
exit 1
5353
fi
5454

5555
# Move to system path
5656
echo "Moving gon to /usr/local/bin/"
5757
if ! sudo mv ./gon /usr/local/bin/gon; then
58-
echo "ERROR: Failed to move gon to /usr/local/bin/"
58+
echo "ERROR: Failed to move gon to /usr/local/bin/" >&2
5959
rm -f gon.zip ./gon
6060
exit 1
6161
fi
6262

6363
if ! sudo chmod +x /usr/local/bin/gon; then
64-
echo "ERROR: Failed to set executable permissions on /usr/local/bin/gon"
64+
echo "ERROR: Failed to set executable permissions on /usr/local/bin/gon" >&2
6565
exit 1
6666
fi
6767

6868
# Verify installation
6969
echo "Verifying gon installation..."
7070
if ! gon --version; then
71-
echo "ERROR: gon --version failed after installation"
71+
echo "ERROR: gon --version failed after installation" >&2
7272
exit 1
7373
fi
7474

.github/scripts/release/prepare-macos-artifacts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function main {
1010
local -r bin_dir="${2:-bin}"
1111

1212
if [[ ! -d "$artifacts_dir" ]]; then
13-
echo "ERROR: Artifacts directory $artifacts_dir does not exist"
13+
echo "ERROR: Artifacts directory $artifacts_dir does not exist" >&2
1414
exit 1
1515
fi
1616

@@ -24,7 +24,7 @@ function main {
2424

2525
# Verify we found macOS binaries
2626
if ! ls "$bin_dir"/terragrunt_darwin_* > /dev/null 2>&1; then
27-
echo "ERROR: No macOS binaries (terragrunt_darwin_*) found in $artifacts_dir"
27+
echo "ERROR: No macOS binaries (terragrunt_darwin_*) found in $artifacts_dir" >&2
2828
exit 1
2929
fi
3030

.github/scripts/release/set-permissions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function main {
1313
local -r bin_dir="${1:-bin}"
1414

1515
if [[ ! -d "$bin_dir" ]]; then
16-
echo "ERROR: Directory $bin_dir does not exist"
16+
echo "ERROR: Directory $bin_dir does not exist" >&2
1717
exit 1
1818
fi
1919

@@ -32,7 +32,7 @@ function main {
3232
chmod +x "$binary"
3333
echo "Set +x on $binary"
3434
else
35-
echo "Warning: Binary $binary not found, skipping"
35+
echo "Warning: Binary $binary not found, skipping" >&2
3636
fi
3737
done
3838

.github/scripts/release/sign-checksums.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ function main {
1919
local -r bin_dir="${1:-bin}"
2020

2121
if [[ ! -d "$bin_dir" ]]; then
22-
echo "ERROR: Directory $bin_dir does not exist"
22+
echo "ERROR: Directory $bin_dir does not exist" >&2
2323
exit 1
2424
fi
2525

2626
if [[ -z "${GPG_FINGERPRINT}" ]]; then
27-
echo "ERROR: GPG_FINGERPRINT environment variable is not set"
27+
echo "ERROR: GPG_FINGERPRINT environment variable is not set" >&2
2828
exit 1
2929
fi
3030

3131
if [[ -z "${SIGNING_GPG_PASSPHRASE}" ]]; then
32-
echo "ERROR: SIGNING_GPG_PASSPHRASE environment variable is not set"
32+
echo "ERROR: SIGNING_GPG_PASSPHRASE environment variable is not set" >&2
3333
exit 1
3434
fi
3535

3636
# Use pushd/popd to avoid side effects on caller's working directory
3737
pushd "$bin_dir" || exit 1
3838

3939
if [[ ! -f "SHA256SUMS" ]]; then
40-
echo "ERROR: SHA256SUMS file not found in $bin_dir"
40+
echo "ERROR: SHA256SUMS file not found in $bin_dir" >&2
4141
popd || exit 1
4242
exit 1
4343
fi

.github/scripts/release/sign-macos-binaries.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function main {
2222
: "${MACOS_CERTIFICATE_PASSWORD:?ERROR: MACOS_CERTIFICATE_PASSWORD is a required environment variable}"
2323

2424
if [[ ! -d "$bin_dir" ]]; then
25-
echo "ERROR: Directory $bin_dir does not exist"
25+
echo "ERROR: Directory $bin_dir does not exist" >&2
2626
exit 1
2727
fi
2828

@@ -68,7 +68,7 @@ function main {
6868

6969
# Check ZIP file exists
7070
[[ -f "$zip_file" ]] || {
71-
echo "ERROR: ZIP file $zip_file not found for binary $binary"
71+
echo "ERROR: ZIP file $zip_file not found for binary $binary" >&2
7272
exit 1
7373
}
7474

@@ -77,13 +77,13 @@ function main {
7777

7878
# Check extraction succeeded
7979
[[ -f "$binary" ]] || {
80-
echo " ERROR: Failed to extract binary $binary from $zip_file"
80+
echo " ERROR: Failed to extract binary $binary from $zip_file" >&2
8181
exit 1
8282
}
8383

8484
echo " Extracted binary exists, checking signature..."
8585
codesign -dv --verbose=4 "$binary" 2>&1 || {
86-
echo " ERROR: Signature verification failed for binary $binary"
86+
echo " ERROR: Signature verification failed for binary $binary" >&2
8787
exit 1
8888
}
8989

@@ -103,12 +103,12 @@ function main {
103103
echo "Verifying $binary..."
104104

105105
[[ -f "$bin_dir/$binary" ]] || {
106-
echo "ERROR: Binary $bin_dir/$binary not found after processing"
106+
echo "ERROR: Binary $bin_dir/$binary not found after processing" >&2
107107
exit 1
108108
}
109109

110110
codesign -dv --verbose=4 "$bin_dir/$binary" || {
111-
echo "ERROR: Signature verification failed for binary $bin_dir/$binary"
111+
echo "ERROR: Signature verification failed for binary $bin_dir/$binary" >&2
112112
exit 1
113113
}
114114
done

.github/scripts/release/upload-assets.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function main {
1818
: "${GH_TOKEN:?ERROR: GH_TOKEN is a required environment variable}"
1919

2020
if [[ ! -d "$bin_dir" ]]; then
21-
echo "ERROR: Directory $bin_dir does not exist"
21+
echo "ERROR: Directory $bin_dir does not exist" >&2
2222
exit 1
2323
fi
2424

@@ -42,7 +42,7 @@ function main {
4242
if gh release upload "$VERSION" "$file" $clobber_flag; then
4343
echo "Uploaded $file"
4444
else
45-
echo "Upload failed for $file (will retry in verification)"
45+
echo "Upload failed for $file (will retry in verification)" >&2
4646
fi
4747
done
4848

.github/scripts/release/verify-assets-uploaded.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ function main {
6262
break
6363
fi
6464

65-
echo "Upload attempt $((i+1))/$MAX_RETRIES failed"
65+
echo "Upload attempt $((i+1))/$MAX_RETRIES failed" >&2
6666
sleep 5
6767
done
6868

6969
if (( i == MAX_RETRIES )); then
70-
echo "Failed to upload $expected_file after $MAX_RETRIES retries"
70+
echo "Failed to upload $expected_file after $MAX_RETRIES retries" >&2
7171
exit 1
7272
fi
7373
else
74-
echo "File $bin_dir/$expected_file not found locally"
74+
echo "File $bin_dir/$expected_file not found locally" >&2
7575
exit 1
7676
fi
7777
else
@@ -88,7 +88,7 @@ function main {
8888
if curl -sILf "$download_url" > /dev/null; then
8989
echo "Assets are downloadable"
9090
else
91-
echo "Warning: Could not verify asset download URL"
91+
echo "Warning: Could not verify asset download URL" >&2
9292
fi
9393

9494
local expected_count
@@ -102,7 +102,7 @@ function main {
102102
echo "Actual files: $asset_count"
103103

104104
if [[ "$asset_count" -lt "$expected_count" ]]; then
105-
echo "Warning: Expected $expected_count files, found $asset_count"
105+
echo "Warning: Expected $expected_count files, found $asset_count" >&2
106106
fi
107107

108108
return 0

.github/scripts/release/verify-binaries-downloaded.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function main {
3232
expected_count=$(resolve_expected_count "$count_override")
3333

3434
if [[ ! -d "$bin_dir" ]]; then
35-
echo "ERROR: Directory $bin_dir does not exist"
35+
echo "ERROR: Directory $bin_dir does not exist" >&2
3636
exit 1
3737
fi
3838

@@ -54,7 +54,7 @@ function main {
5454
echo "Expected: at least $expected_count binaries"
5555

5656
if [[ "$binary_count" -lt "$expected_count" ]]; then
57-
echo "ERROR: Expected at least $expected_count binaries, found $binary_count"
57+
echo "ERROR: Expected at least $expected_count binaries, found $binary_count" >&2
5858
exit 1
5959
fi
6060

0 commit comments

Comments
 (0)