Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Bug: 'target' can't be a deploy directory anymore #508

Closed
mainej opened this issue Dec 18, 2020 · 2 comments · Fixed by #521
Closed

Bug: 'target' can't be a deploy directory anymore #508

mainej opened this issue Dec 18, 2020 · 2 comments · Fixed by #521

Comments

@mainej
Copy link

mainej commented Dec 18, 2020

I have a project that compiles into the target directory, a sub-directory of my repo. My site is configured to use target as the 'deploy' directory (aka the 'publish' directory, I think.) This was working until recently.

Recent changes to this netlify/build-image mean that it assumes every project is a rust project, regardless of whether the project uses rust, and that therefore target is cache-able. You can see this by git blameing the following line:

cache_cwd_directory "target" "rust compile output"

After my build finishes (successfully), the caching code mvs the target directory. See this line:

mv $src $dst

Because of this, the /opt/buildhome/repo/target directory doesn't exist when the deploy starts, and the build fails with the log message "Failed during stage 'building site': Deploy directory 'target' does not exist".

I can think of a few fixes:

  1. The build functions could check whether the project uses rust before trying to cache the target directory.
  2. The build could run the deploy before starting the caching.
  3. The caching code could cp the cacheable directories, instead of mving them.
  4. The Support Guide could document forbidden deploy directories.

In the meantime, I'll try to compile to a different directory.

I was able to debug this using the docker image. My prior attempts to fix the problem are documented in this support ticket.

@mainej
Copy link
Author

mainej commented Dec 18, 2020

Confirmed: after changing the build (aka publish) directory from target to release, my site deployed successfully.

@changke
Copy link

changke commented Jan 4, 2021

Can confirm. The directory name "target" is kind of "reserved".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants