Skip to content

Commit afa1fd3

Browse files
committed
Allow Travis to continue build if decryption fails.
Decryption of the service key can fail if Travis is building from a fork instead of a branch.
1 parent 89e9e51 commit afa1fd3

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

.travis.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515
language: java
1616
jdk:
1717
- oraclejdk8
18-
env:
19-
- GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/service-account.json GCLOUD_PROJECT=cloud-samples-tests
2018
before_install:
2119
- openssl aes-256-cbc -K $encrypted_37a4f399de75_key -iv $encrypted_37a4f399de75_iv -in service-account.json.enc -out service-account.json -d
22-
23-
script: mvn --batch-mode clean verify -DskipTests=false | egrep -v "(^\[INFO\] Download|^\[INFO\].*skipping)"
20+
&& export GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/service-account.json GCLOUD_PROJECT=cloud-samples-tests
21+
|| true
22+
# Skip the install step, since Maven will download the dependencies we need
23+
# when the test build runs.
24+
# http://stackoverflow.com/q/31945809/101923
25+
# https://docs.travis-ci.com/user/customizing-the-build/#Skipping-the-Installation-Step
26+
install: true
27+
script: ./travis.sh
2428
after_success:
2529
- mvn clean cobertura:cobertura coveralls:report
2630
branches:

travis.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2016 Google Inc. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -e
17+
set -x
18+
# Set pipefail so that `egrep` does not eat the exit code.
19+
set -o pipefail
20+
21+
SKIP_TESTS=false
22+
if [ -z "$GOOGLE_APPLICATION_CREDENTIALS"]; then
23+
SKIP_TESTS=true
24+
fi
25+
mvn --batch-mode clean verify -DskipTests=$SKIP_TESTS | egrep -v "(^\[INFO\] Download|^\[INFO\].*skipping)"
26+

0 commit comments

Comments
 (0)