Skip to content

repo:purge_cache doesn't purge all files #70

@edmorley

Description

@edmorley

The repo:purge_cache command doesn't actually remove all files from the cache, but tries to preserve anything under vendor/heroku/:

METADATA="vendor/heroku"
if [ -d "$METADATA" ]; then
TMPDIR=\`mktemp -d\`
cp -rf $METADATA $TMPDIR
fi
cd ..
rm -rf unpack
mkdir unpack
cd unpack
TMPDATA="$TMPDIR/heroku"
VENDOR="vendor"
if [ -d "$TMPDATA" ]; then
mkdir $VENDOR
cp -rf $TMPDATA $VENDOR
rm -rf $TMPDIR
fi

This was added in:
16b17f3

I believe the intention was to preserve the implicit previous Ruby version, for apps that don't define a specific required version.

However this seems flawed/fragile for a few reasons:

  1. There isn't a command to unconditionally delete all files for users who really want to.
  2. It's likely confusing to the user if there's still hidden state preserved after clearing the cache (eg think of the use case of "why doesn't my new stage app or review apps work, my prod app still works after clearing the cache")
  3. It only helps Ruby apps, and even then only so long as the path for the Ruby metadata doesn't change from vendor/heroku/. (Each buildpack does it's own thing, for example Python uses the .heroku/python directory instead)
  4. Even if the language runtime version is preserved, it doesn't help the user if they haven't pinned eg package deps properly etc.

As such I would propose either:

  1. Scrapping the partial cache clearing version of the command entirely, and just clearing the whole cache.
  2. Offering two commands - one that clears the whole cache, and one that tries to preserve certain files. The latter command should be improved to also save the Python/other buildpacks' metadata too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions