rafecolton / docker-builder

Docker builder builds Docker images from a friendly config file.
MIT License
80 stars 11 forks source link

Fixing file copy issue #25

Closed rafecolton closed 10 years ago

rafecolton commented 10 years ago

Fixes https://github.com/modcloth/bob/issues/18

The issue appears to have been in bob.go - the bob.CleanWorkdir() and bob.Setup() functions both return errors, but we weren't capturing those errors. The result was that sometimes, copying files from the repo dir to the workdir would fail on certain files, but because the error wasn't getting checked, the flow would continue.

Why did the copy fail? In one case, the file .env existed in the repo dir as a symlink to .example.env, which didn't exist. Therefore, when bob tried to open the source file for the copy, it would fail. I cannot state with certainty that this is the only case that would cause this bug to manifest.

Why did that cause the build to fail intermittently? Whether or not it failed was determined by the order in which the files got added. Basically, whenever bob attempted to copy the "bad" file (.env in this case) all file copying would stop. If that was the last file, as long as it wasn't explicitly added by a docker ADD command, the build would succeed. However, if bob tried to copy the "bad" file first, then other important files wouldn't get copied over (i.e. the Dockerfile), and the build would fail.