8000 travisify.sh: add better travis CLI error checking · oeway/scijava-scripts@5903db5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5903db5

Browse files
committed
travisify.sh: add better travis CLI error checking
If the tool does not work as expected, fail fast.
1 parent 2e97cbb commit 5903db5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

travisify.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ EOL
187187
esac
188188
info "Encrypting ${p%%=*}"
189189
$EXEC travis encrypt "$p" --add env.global --repo "$repoSlug"
190+
test $? -eq 0 || die "Failed to encrypt variable '$p'"
190191
done <"$varsFile"
191192
$EXEC git commit "$travisConfig" -m "Travis: add encrypted environment variables"
192193
else
@@ -199,7 +200,10 @@ EOL
199200
info "Encrypting $signingKeyDestFile"
200201
if [ -z "$EXEC" ]
201202
then
202-
encryptResult=$(travis encrypt-file "$signingKeySourceFile" "$signingKeyDestFile.enc" --repo "$repoSlug" | grep openssl)
203+
encryptOutput=$(travis encrypt-file "$signingKeySourceFile" "$signingKeyDestFile.enc" --repo "$repoSlug")
204+
test $? -eq 0 || die "Failed to encrypt signing key."
205+
encryptResult=$(echo "$encryptOutput" | grep openssl)
206+
test "$encryptResult" || die "No openssl variables emitted."
203207
key=$(echo "$encryptResult" | cut -d' ' -f4)
204208
iv=$(echo "$encryptResult" | cut -d' ' -f6)
205209
sed -i.bak "s/\(sh travis-build.sh\)/\1 $key $iv/" "$travisBuildScript"

0 commit comments

Comments
 (0)
0