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

Remote caching resurfaces resources with old filenames #6394

Closed
badeball opened this issue Mar 15, 2021 · 1 comment · Fixed by #6554
Closed

Remote caching resurfaces resources with old filenames #6394

badeball opened this issue Mar 15, 2021 · 1 comment · Fixed by #6554

Comments

@badeball
Copy link

Steps

$ git clone https://github.com/badeball/sbt-remote-cache-bug
$ cd sbt-remote-cache-bug

.. then run the command described in the readme and watch Flyway fail.

$ rm -rf remote-cache && \
  find -type d -name target -exec rm -r {} + && \
  docker run \
    --rm \
    --detach \
    --name mssql \
    --publish 1433:1433 \
    --env ACCEPT_EULA=Y \
    --env SA_PASSWORD=Password123 \
      mcr.microsoft.com/mssql/server:2017-CU14-ubuntu && \
  sleep 5s && \
  docker exec mssql \
    /opt/mssql-tools/bin/sqlcmd \
      -S localhost \
      -U SA \
      -P Password123 \
      -Q "CREATE DATABASE foobar_database;"
  git checkout master && \
  sbt compile && \
  sbt pushRemoteCache && \
  find -type d -name target -exec rm -r {} + && \
  git checkout moved-migration && \
  sbt pullRemoteCache && \
  sbt compile && \
  (sbt flywayMigrate || true) && \
  docker stop mssql

Problem

What happens here is that we prime a remote-cache (local directory) with a database migration. Then we checkout another branch where said migration has been renamed and we delete target directories to simulate another developer. We then pull from the cache, compile and run flyway. This fails, because somehow two migration resources end up in a target directory, which isn't going to work.

Expectation

I think this is an unexpected outcome. It's certainly extremely detrimental to our use case, which is speeding up CI. The use of caching ends up destroying pipelines and requires manual intervention from us.

I think that I expect compile output to always be identical whether a cache is used or not, provided that 1) compiling is deterministic and 2) I trust the cache. Now, I know Scala compilation isn't entirely deterministic, but that's beyond the point here. I still expect the compile output to the correct / working, but not necessarily identical.

Notes

  • OS: Arch Linux
  • Sbt version: 1.4.6
  • Java version: openjdk 11
@eed3si9n
Copy link
Member

@badeball Thanks for the report with a reproduction project.

@Nirvikalpa108 Nirvikalpa108 self-assigned this May 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants