codeship/scripts

Elixir - occasional corrupt ZIP download

Closed this issue · 1 comments

Occasionally, we will see the following:

--2017-06-12 18:33:46--  https://s3.amazonaws.com/s3.hex.pm/builds/elixir/v1.4.zip
Resolving s3.amazonaws.com (s3.amazonaws.com)... 52.216.16.195
Connecting to s3.amazonaws.com (s3.amazonaws.com)|52.216.16.195|:443... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

The file is already fully retrieved; nothing to do.

error [/home/rof/cache/elixir-v1.4.zip]:  start of central directory not found;
zipfile corrupt.
(please check that you have transferred or created the zipfile in the
appropriate BINARY mode and that you have compiled UnZip properly)
bash: elixir: command not found

The elixir.sh script won't attempt to re-download the corrupt file until the Cache is cleared.

I've seen this happen a few times before on cached downloads as well. The solution as you mentioned is to clear the offending item from the project's cache.

The default behavior for the script is to always cache the downloaded copy and work off that, but if you want to ensure it downloads a fresh copy each time there are a few different options:

  • Add cs clear-cache to the start of your build and this will wipe out the entire cache at the start of each build
  • Add rm elixir-* to the start of the build to just remove the elixir download, but leave the rest of the cache intact
  • You could also make your own copy of our script and add it to your repo and modify it not to use the cached directory