Skip to content

Commit 693e37b

Browse files
author
Victor Santos
committed
feat: add validation for APK private key and RPM signing key ID
- Implemented checks to ensure the APK private key exists before proceeding with APK processing. - Added validation for the RPM signing key ID to ensure it is configured before uploading RPM packages.
1 parent aab2269 commit 693e37b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

upload_to_cloudsmith.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,21 @@ if ls *.apk 1> /dev/null 2>&1 && [ "$S3_ENABLED" = "true" ]; then
5757
echo "Syncing existing APK packages from S3..."
5858
aws s3 sync "s3://$INFISICAL_CLI_S3_BUCKET/apk/" apk-staging/ --exclude "*/APKINDEX.tar.gz"
5959

60+
# Validate APK private key exists
61+
if [ ! -f "$APK_PRIVATE_KEY_PATH" ]; then
62+
echo "Error: APK private key not found at $APK_PRIVATE_KEY_PATH"
63+
exit 1
64+
fi
65+
6066
# Generate APKINDEX using Alpine container
6167
echo "Generating APKINDEX.tar.gz using Alpine container..."
6268
docker run --rm \
6369
-v "$(pwd)/apk-staging:/repo" \
6470
-v "$APK_PRIVATE_KEY_PATH:/keys/infisical.rsa:ro" \
6571
alpine:3.21 sh -c '
6672
set -e
67-
apk add --no-cache alpine-sdk > /dev/null 2>&1
73+
echo "Installing alpine-sdk..."
74+
apk add --no-cache alpine-sdk || { echo "Failed to install alpine-sdk"; exit 1; }
6875
6976
# Process x86_64
7077
if ls /repo/stable/main/x86_64/*.apk 1> /dev/null 2>&1; then
@@ -110,6 +117,12 @@ done
110117
# RPM - Upload to S3 and regenerate repo metadata
111118
# ============================================
112119
if [ "$S3_ENABLED" = "true" ]; then
120+
# Validate signing key ID is configured for RPM
121+
if [ -z "$INFISICAL_CLI_REPO_SIGNING_KEY_ID" ]; then
122+
echo "Error: INFISICAL_CLI_REPO_SIGNING_KEY_ID not set"
123+
exit 1
124+
fi
125+
113126
for i in *.rpm; do
114127
[ -f "$i" ] || break
115128

0 commit comments

Comments
 (0)