diff --git a/Jenkinsfile b/Jenkinsfile index 6a7927d2a0527a3efe6f4515c13d9f761b96ac1c..92bfa0a305bd009a543b1c44700f0023176adbcc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -118,14 +118,13 @@ readTrusted 'pom.xml' withCredentials([string(credentialsId: 'maxmind-license-key', variable: 'MAXMIND_LICENSE_KEY')]) { - sh 'mkdir -p /tmp/maxmind && ./bin/maxmind.sh /tmp/maxmind' + sh 'mkdir -p ./maxmind && ./bin/maxmind.sh $PWD/maxmind' } sh 'make production-build' stash includes: 'target/', name: 'target' - dir('/tmp') { - stash includes: 'maxmind/', name: 'maxmind' - } + stash includes: 'maxmind/**/*', name: 'maxmind' + } } } diff --git a/Makefile b/Makefile index 7a78da1ddf4d8f8a130400479dd8c44b5e7060c7..cc55a91046fae2ff27566d9aed28979415db1713 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ install: clean; yarn install --frozen-lockfile sh ./bin/maxmind.sh maxmind/ package: install; - mvn compile package -Declipse.maxmind.root=${PWD}/maxmind + mvn compile package dirty-package:; mvn compile package -Declipse.maxmind.root=${PWD}/maxmind production-build:; diff --git a/bin/maxmind.sh b/bin/maxmind.sh index a7abfd3cd270ea4c06c34d9217b1dbe12a28633e..28b1d7ee079d509c34dc9cdba016203ccc7fd354 100755 --- a/bin/maxmind.sh +++ b/bin/maxmind.sh @@ -31,11 +31,14 @@ fi mkdir -p "${1}/bin" mkdir -p "${1}/db" -pushd "${1:-"."}" || exit 1 +MM_OUTPUT_DIR=${1} +( +cd "$MM_OUTPUT_DIR" +echo "Current directory: $(pwd)" echo "Getting data from MaxMind" -curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&suffix=tar.gz&license_key=$MAXMIND_LICENSE_KEY" | tar zxv -C bin --wildcards '*.mmdb' -curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&suffix=tar.gz&license_key=$MAXMIND_LICENSE_KEY" | tar zxv -C bin --wildcards '*.mmdb' +curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&suffix=tar.gz&license_key=$MAXMIND_LICENSE_KEY" | tar zxv -C bin +curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&suffix=tar.gz&license_key=$MAXMIND_LICENSE_KEY" | tar zxv -C bin curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&suffix=zip&license_key=$MAXMIND_LICENSE_KEY" -o GeoLite2-Country-CSV.zip unzip GeoLite2-Country-CSV.zip rm -vf GeoLite2-Country-CSV.zip @@ -52,4 +55,7 @@ mv -vf bin/GeoLite2-**/GeoLite2-C*.mmdb bin/ rm -rvf bin/GeoLite2-City_* rm -rvf bin/GeoLite2-Country_* -popd || exit 1 +echo "Final output to $(pwd):\n$(ls)" +echo "Final output to $(pwd)/db:\n$(ls db)" +echo "Final output to $(pwd)/bin:\n$(ls bin)" +)