Skip to content

Commit 091229b

Browse files
authored
breaking change (GoogleCloudPlatform#796)
* breaking change Try switching to circleci v2 * fix some spacing * add a workflow * remove workflows * indent fix. * skip backports and more. * maybe working * more stuff * weird errors * weird * remove whitespace * argh * more explicit path * change digest to md5 * fix travis path * Rookie errors * more rookie errors * try again * try and give me a service account * clean a few things up. * quick final info
1 parent 2055dc7 commit 091229b

File tree

3 files changed

+40
-35
lines changed

3 files changed

+40
-35
lines changed

.circleci/circle.yml

-17
This file was deleted.

.circleci/config.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/openjdk:8-jdk-browsers
6+
steps:
7+
- checkout
8+
- run:
9+
name: get shellcheck expect
10+
command: sudo apt-get update && sudo apt-get install shellcheck expect
11+
- run:
12+
name: service account
13+
command: openssl aes-256-cbc -d -md md5 -in "${HOME}/project/service-account.json.enc" -k "${key}" -iv "${iv}" -out "${HOME}/google-cloud-service-key.json" && echo 'export GOOGLE_APPLICATION_CREDENTIALS="${HOME}/google-cloud-service-key.json"' >> $BASH_ENV
14+
- run:
15+
name: test script
16+
command: bash "${HOME}/project/travis.sh" && bash <(curl -s https://codecov.io/bash) # If successful, run code coverage
17+
18+
# - run:
19+
# name: Gecko Driver
20+
# command: curl -LO https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz && sudo tar -zxf geckodriver-*.tar.gz -C "${HOME}/bin"
21+

travis.sh

+19-18
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@
1515

1616
set -e
1717

18-
# Setup GCP application default credentials before `set -x` echos everything out
19-
if [[ $GCLOUD_SERVICE_KEY ]]; then
20-
echo "$GCLOUD_SERVICE_KEY" | \
21-
base64 --decode --ignore-garbage > "${HOME}/google-cloud-service-key.json"
22-
export GOOGLE_APPLICATION_CREDENTIALS="${HOME}/google-cloud-service-key.json"
23-
fi
18+
cd "${HOME}/project" # lv3 8/8/17
2419

2520
set -x
2621
# Set pipefail so that `egrep` does not eat the exit code.
2722
set -o pipefail
2823
shopt -s globstar
2924

25+
echo "GOOGLE_APPLICATION_CREDENTIALS: ${GOOGLE_APPLICATION_CREDENTIALS}"
26+
echo "CI_PULL_REQUEST: ${CI_PULL_REQUEST}"
27+
echo "CIRCLE_BRANCH: ${CIRCLE_BRANCH}"
28+
echo "git rev-parse HEAD: $(git rev-parse HEAD)"
29+
echo "CIRCLE_PR_NUMBER: ${CIRCLE_PR_NUMBER}"
30+
echo "CIRCLE_PR_USERNAME: ${CIRCLE_PR_USERNAME}"
3031

3132
SKIP_TESTS=false
3233
if [ -z "$GOOGLE_APPLICATION_CREDENTIALS" ] ; then
@@ -35,30 +36,29 @@ fi
3536

3637
# Finds the closest parent dir that encompasses all changed files, and has a
3738
# pom.xml
38-
travis_changed_files_parent() {
39+
changed_files_parent() {
3940
# If we're not in a PR, forget it
40-
[ -z "${TRAVIS_PULL_REQUEST-CI_PULL_REQUEST}" ] && return 0
41+
[ -z "${CI_PULL_REQUEST}" ] && return 0
4142

4243
(
4344
set +e
4445

45-
changed="$(git diff --name-only "${TRAVIS_COMMIT-CIRCLE_SHA1}" "${TRAVIS_BRANCH-CIRCLE_BRANCH}")"
46+
changed="$(git diff --name-only ${CIRCLE_SHA1} ${CIRCLE_BRANCH})"
4647
if [ $? -ne 0 ]; then
4748
# Fall back to git head
48-
changed="$(git diff --name-only "$(git rev-parse HEAD)" "${TRAVIS_BRANCH-CIRCLE_BRANCH}")"
49+
changed="$(git diff --name-only $(git rev-parse HEAD) ${CIRCLE_BRANCH})"
4950
[ $? -ne 0 ] && return 0 # Give up. Just run everything.
5051
fi
5152

5253
# Find the common prefix
53-
prefix="$(echo "$changed" | \
54+
prefix="$(echo $changed | sed -e 'N;s/^\(.*\).*\n\1.*$/\1\n\1/;D')"
5455
# N: Do this for a pair of lines
5556
# s: capture the beginning of a line, that's followed by a new line
5657
# starting with that capture group. IOW - two lines that start with the
5758
# same zero-or-more characters. Replace it with just the capture group
5859
# (ie the common prefix).
5960
# D: Delete the first line of the pair, leaving the second line for the
6061
# next pass.
61-
sed -e 'N;s/^\(.*\).*\n\1.*$/\1\n\1/;D')"
6262

6363
while [ ! -z "$prefix" ] && [ ! -r "$prefix/pom.xml" ] && [ "${prefix%/*}" != "$prefix" ]; do
6464
prefix="${prefix%/*}"
@@ -70,19 +70,20 @@ travis_changed_files_parent() {
7070
)
7171
}
7272

73-
common_travis_dir="$(travis_changed_files_parent)"
73+
common_dir="$(changed_files_parent)"
74+
75+
echo "Common Dir: ${common_dir}"
7476

75-
[ -z "$common_travis_dir" ] || pushd "$common_travis_dir"
77+
[ -z "${common_dir}" ] || pushd "${common_dir}"
7678

7779
# Give Maven a bit more memory
78-
#export MAVEN_OPTS='-XX:+PrintFlagsFinal -Xmx800m -Xms400m'
7980
export MAVEN_OPTS='-Xmx800m -Xms400m'
80-
"${TRAVIS_BUILD_DIR-$HOME/$CIRCLE_PROJECT_REPONAME}"/mvnw \
81+
mvn \
8182
--batch-mode clean verify -e \
8283
-DskipTests=$SKIP_TESTS | \
8384
egrep -v "(^\[INFO\] Download|^\[INFO\].*skipping)"
8485

85-
[ -z "$common_travis_dir" ] || popd
86+
[ -z "$common_dir" ] || popd
8687

8788
# Check that all shell scripts in this repo (including this one) pass the
8889
# Shell Check linter.
@@ -99,7 +100,7 @@ test_localhost() {
99100
appengine/datastore/indexes-perfect
100101
)
101102
for testdir in "${devserver_tests[@]}" ; do
102-
if [ -z "$common_travis_dir" ] || [[ $testdir = $common_travis_dir* ]]; then
103+
if [ -z "$common_dir" ] || [[ $testdir = $common_dir* ]]; then
103104
./java-repo-tools/scripts/test-localhost.sh appengine "${testdir}"
104105
fi
105106
done

0 commit comments

Comments
 (0)