Skip to content

Commit 83f4a00

Browse files
committed
ci: skip Gradle signing when GPG key is absent
1 parent e162373 commit 83f4a00

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.gitlab/scripts/deploy.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ if [ "$MODE" = "publish" ] || [ "$MODE" = "all" ]; then
2929
export GPG_PASSWORD=$(aws ssm get-parameter --region ${AWS_REGION} --name ${SSM_PREFIX}.signing.gpg_passphrase --with-decryption --query "Parameter.Value" --out text)
3030
fi
3131

32+
# Determine whether signing is available (key present and non-empty)
33+
SIGNING_SKIP_FLAG=""
34+
if [ -z "${GPG_PRIVATE_KEY:-}" ]; then
35+
echo "WARNING: GPG_PRIVATE_KEY not set — signing will be skipped"
36+
SIGNING_SKIP_FLAG="-Psigning.skip=true"
37+
fi
38+
3239
source .gitlab/scripts/includes.sh
3340

3441
LIB_VERSION=$(get_version)
@@ -37,11 +44,11 @@ echo "com.datadoghq:ddprof:${LIB_VERSION}" > version.txt
3744
# Assemble task (always needed for artifact creation)
3845
if [ "$MODE" = "assemble" ] || [ "$MODE" = "all" ]; then
3946
echo "=== Assembling artifact ==="
40-
./gradlew -Pskip-native -Pskip-tests -Pddprof_version="${LIB_VERSION}" -PbuildInfo.build.number=$CI_JOB_ID -Pwith-libs="$(pwd)/libs" :ddprof-lib:jar assembleAll --exclude-task compileFuzzer --exclude-task sign --max-workers=1 --no-build-cache --stacktrace --info --no-watch-fs --no-daemon
47+
./gradlew -Pskip-native -Pskip-tests -Pddprof_version="${LIB_VERSION}" -PbuildInfo.build.number=$CI_JOB_ID -Pwith-libs="$(pwd)/libs" ${SIGNING_SKIP_FLAG} :ddprof-lib:jar assembleAll --exclude-task compileFuzzer --exclude-task sign --max-workers=1 --no-build-cache --stacktrace --info --no-watch-fs --no-daemon
4148
fi
4249

4350
# Publish task (only when publishing to Maven Central)
4451
if [ "$MODE" = "publish" ] || [ "$MODE" = "all" ]; then
4552
echo "=== Publishing to Sonatype ==="
46-
./gradlew -Pskip-native -Pskip-tests -Pddprof_version="${LIB_VERSION}" -PbuildInfo.build.number=$CI_JOB_ID -Pwith-libs="$(pwd)/libs" publishToSonatype closeAndReleaseSonatypeStagingRepository --exclude-task compileFuzzer --max-workers=1 --no-build-cache --stacktrace --info --no-watch-fs --no-daemon
53+
./gradlew -Pskip-native -Pskip-tests -Pddprof_version="${LIB_VERSION}" -PbuildInfo.build.number=$CI_JOB_ID -Pwith-libs="$(pwd)/libs" ${SIGNING_SKIP_FLAG} publishToSonatype closeAndReleaseSonatypeStagingRepository --exclude-task compileFuzzer --max-workers=1 --no-build-cache --stacktrace --info --no-watch-fs --no-daemon
4754
fi

0 commit comments

Comments
 (0)