Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache handling error when requirements.txt is no longer symlinked #1675

Closed
edmorley opened this issue Oct 30, 2024 · 0 comments · Fixed by #1679
Closed

Cache handling error when requirements.txt is no longer symlinked #1675

edmorley opened this issue Oct 30, 2024 · 0 comments · Fixed by #1679
Assignees
Labels

Comments

@edmorley
Copy link
Member

As reported in heroku/buildpacks#42 by @abingham:

In short: I replaced a symlink in my repo with a normal file, and now my deployments fail with the error:

cp: not writing through dangling symlink '/tmp/codon/tmp/cache/.heroku/requirements.txt'
 !     Push rejected, failed to compile Python app.
 !     Push failed

requirements.txt is the file that used to be a symlink and is now a file.

I can reproduce this myself.

The cause are the dubious copies here:

if [[ ! -f "$CACHE_DIR/.heroku/requirements.txt" ]]; then
# This is a the first build of an app (or the build cache was cleared). Since there
# are no cached packages, we only need to store the requirements file for next time.
cp -R "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt"
else
# IF there IS a cached directory, check for differences with the new one
if ! diff "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt" &>/dev/null; then
output::step "Requirements file has been changed, clearing cached dependencies"
# if there are any differences, clear the Python cache
# Installing Python over again does not take noticably more time
cp -R "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt"

This issue amongst others will be fixed by the upcoming cache refactor :-)

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

Successfully merging a pull request may close this issue.

1 participant