[packer_cache] make packer_cache idempotent (#34241)

When issues arise while building the packer_cache, like the ongoing es snapshot download errors, the cache scripts
are retried (up to 5 attempts). In order for this to work the script needs to be idempotent, but `mkdir` is failing
if the .chromedriver or .geckodriver directory already exists because they were not using the -p option.
This commit is contained in:
Spencer 2019-03-31 18:23:23 -07:00 committed by GitHub
parent 3e23f166c0
commit 118debef21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,8 +21,7 @@ if [ -z "$chromedriverDistVersion" ] || [ -z "$chromedriverPkgVersion" ]; then
echo "UNABLE TO DETERMINE CHROMEDRIVER VERSIONS"
exit 1
fi
mkdir ".chromedriver"
mkdir -p .chromedriver
curl "https://chromedriver.storage.googleapis.com/$chromedriverDistVersion/chromedriver_linux64.zip" > .chromedriver/chromedriver.zip
echo "$chromedriverPkgVersion" > .chromedriver/pkgVersion
@ -32,7 +31,7 @@ if [ -z "$geckodriverPkgVersion" ]; then
echo "UNABLE TO DETERMINE geckodriver VERSIONS"
exit 1
fi
mkdir ".geckodriver"
mkdir -p ".geckodriver"
cp "node_modules/geckodriver/geckodriver.tar.gz" .geckodriver/geckodriver.tar.gz
echo "$geckodriverPkgVersion" > .geckodriver/pkgVersion