Skip to content
This repository was archived by the owner on Oct 5, 2021. It is now read-only.

Commit fca509d

Browse files
ngrigorievAlexander Patrikalakis
authored andcommitted
Better handling of failed downloads (#207)
Introduced a command line option "-f" for install-gremlin-server.sh that forces re-downloading of the files and ignores the cache contents. Rolled back to the original 1.2.1 version of the download plugin - looks like the overwrite option does no behave as documented in 1.3.0. Fixed minor issue with one of mkdir commands, the script was failing if started for the second time.
1 parent 034d5e5 commit fca509d

File tree

2 files changed

+43
-8
lines changed

2 files changed

+43
-8
lines changed

pom.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<maven.failsafe.version>2.19.1</maven.failsafe.version>
2929
<maven.resources.plugin.version>2.7</maven.resources.plugin.version>
3030
<exec.maven.plugin.version>1.2</exec.maven.plugin.version>
31-
<download.maven.plugin.version>1.3.0</download.maven.plugin.version>
31+
<download.maven.plugin.version>1.2.1</download.maven.plugin.version>
3232
<slf4j.version>1.7.21</slf4j.version>
3333
<opencsv.version>3.8</opencsv.version>
3434
<metrics3.version>3.0.1</metrics3.version>
@@ -41,6 +41,8 @@
4141
<include.category></include.category>
4242
<exclude.category></exclude.category>
4343
<test.excluded.groups>org.janusgraph.testcategory.MemoryTests,org.janusgraph.testcategory.PerformanceTests,org.janusgraph.testcategory.BrittleTests,org.janusgraph.testcategory.OrderedKeyStoreTests,org.janusgraph.testcategory.SerialTests</test.excluded.groups>
44+
<download.skip.cache>false</download.skip.cache>
45+
<download.force.overwrite>false</download.force.overwrite>
4446
</properties>
4547
<developers>
4648
<developer>
@@ -356,6 +358,8 @@
356358
<url>https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip</url>
357359
<unpack>true</unpack>
358360
<outputDirectory>${project.build.directory}/dynamodb</outputDirectory>
361+
<skipCache>${download.skip.cache}</skipCache>
362+
<overwrite>${download.force.overwrite}</overwrite>
359363
</configuration>
360364
</execution>
361365
</executions>
@@ -446,8 +450,8 @@
446450
<url>https://github.com/JanusGraph/janusgraph/releases/download/v${janusgraph.version}/janusgraph-${janusgraph.version}-hadoop2.zip</url>
447451
<unpack>false</unpack>
448452
<outputDirectory>${project.build.directory}/../server</outputDirectory>
449-
<skipCache>true</skipCache>
450-
<overwrite>true</overwrite>
453+
<skipCache>${download.skip.cache}</skipCache>
454+
<overwrite>${download.force.overwrite}</overwrite>
451455
</configuration>
452456
</execution>
453457
</executions>
@@ -473,6 +477,8 @@
473477
<url>https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip</url>
474478
<unpack>true</unpack>
475479
<outputDirectory>${project.build.directory}/dynamodb</outputDirectory>
480+
<skipCache>${download.skip.cache}</skipCache>
481+
<overwrite>${download.force.overwrite}</overwrite>
476482
</configuration>
477483
</execution>
478484
</executions>

src/test/resources/install-gremlin-server.sh

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,38 @@ set -eu
1616
# permissions and limitations under the License.
1717
#
1818

19+
usage() {
20+
echo "Usage: $0 [options]" >&2
21+
echo "Options:" >&2
22+
echo " -f force overwriting of the cached files" >&2
23+
}
24+
25+
MVN_OPT_PARAMS=""
26+
27+
args=$(getopt fh $*)
28+
if [ $? != 0 ] ; then
29+
usage
30+
exit 1
31+
fi
32+
33+
set -- $args
34+
35+
for i ; do
36+
case "$i" in
37+
-f)
38+
MVN_OPT_PARAMS="$MVN_OPT_PARAMS -Ddownload.skip.cache=true -Ddownload.force.overwrite=true"
39+
shift;;
40+
-h)
41+
usage
42+
exit 0;;
43+
--)
44+
shift; break;;
45+
esac
46+
done
47+
1948
#collect the prereqs and build the plugin
2049
export MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
21-
mvn -q -T 1C install -Dmaven.test.skip=true -DskipTests=true
50+
mvn -q -T 1C install -Dmaven.test.skip=true -DskipTests=true $MVN_OPT_PARAMS
2251

2352
# Directory structure of server directory
2453
# -src
@@ -35,12 +64,12 @@ mvn -q -T 1C install -Dmaven.test.skip=true -DskipTests=true
3564
# |-dependencies
3665
# |
3766

38-
export ARTIFACT_NAME=`mvn -q -Dexec.executable="echo" -Dexec.args='${project.artifactId}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
67+
export ARTIFACT_NAME=`mvn -q -Dexec.executable="echo" -Dexec.args='${project.artifactId}' $MVN_OPT_PARAMS --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
3968
export JANUSGRAPH_DYNAMODB_HOME=${PWD}
4069
export JANUSGRAPH_DYNAMODB_TARGET=${JANUSGRAPH_DYNAMODB_HOME}/target
41-
export JANUSGRAPH_VERSION=`mvn -q -Dexec.executable="echo" -Dexec.args='${janusgraph.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
70+
export JANUSGRAPH_VERSION=`mvn -q -Dexec.executable="echo" -Dexec.args='${janusgraph.version}' $MVN_OPT_PARAMS --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
4271
#Extract the DYNAMODB version from the pom.
43-
export DYNAMODB_PLUGIN_VERSION=`mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
72+
export DYNAMODB_PLUGIN_VERSION=`mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' $MVN_OPT_PARAMS --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
4473
export JANUSGRAPH_VANILLA_SERVER_DIRNAME=janusgraph-${JANUSGRAPH_VERSION}-hadoop2
4574
export JANUSGRAPH_VANILLA_SERVER_ZIP=${JANUSGRAPH_VANILLA_SERVER_DIRNAME}.zip
4675
export JANUSGRAPH_DYNAMODB_SERVER_DIRNAME=${ARTIFACT_NAME}-${DYNAMODB_PLUGIN_VERSION}
@@ -65,7 +94,7 @@ export JANUSGRAPH_SERVER_SERVICE_SH=${JANUSGRAPH_SERVER_BIN}/gremlin-server-serv
6594
mkdir -p ${WORKDIR}
6695

6796
#download the server products
68-
mvn test -q -Pdownload-janusgraph-server-zip > /dev/null 2>&1
97+
mvn test -q -Pdownload-janusgraph-server-zip $MVN_OPT_PARAMS > /dev/null 2>&1
6998

7099
#verify
71100
pushd target

0 commit comments

Comments
 (0)