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

Upgrading to 5.1.1 breaks restore #34

Closed
Munksgaard opened this issue Apr 1, 2024 · 3 comments
Closed

Upgrading to 5.1.1 breaks restore #34

Munksgaard opened this issue Apr 1, 2024 · 3 comments

Comments

@Munksgaard
Copy link

I have the following step in my workflow file:

      - name: Restore and cache Nix store
        uses: nix-community/cache-nix-action@v5
        with:
          # restore and save a cache using this key
          primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
          # if there's no cache hit, restore a cache by this prefix
          restore-prefixes-first-match: nix-${{ runner.os }}-
          paths: |
            deps
            _build

After the release of v5.1.1, I get the following error in my CI log:

Run nix-community/cache-nix-action@v5
  with:
    primary-key: nix-Linux-a036be222bc54cc20999ae15695ecdda0db82aa259484b3ab57b0f0b78ae270a
    restore-prefixes-first-match: nix-Linux-
    paths: deps
  _build
  
    skip-restore-on-hit-primary-key: false
    nix: true
    save: true
    purge: false
    save-always: false
    token: ***
  env:
    REGISTRY: ghcr.io
    IMAGE_NAME: redacted/redacted
    NIX_CONFIG: experimental-features = nix-command flakes
    NIX_PROFILES: /nix/var/nix/profiles/default /home/runner/.nix-profile
    NIX_USER_PROFILE_DIR: /nix/var/nix/profiles/per-user/runner
    NIX_SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
    NIX_USER_CONF_FILES: /tmp/tmp.LwlP8djW0a/flake-nixConfig.conf:/home/runner/.config/nix/nix.conf:
Searching for a cache with the key "nix-Linux-a036be222bc54cc20999ae15695ecdda0db82aa259484b3ab57b0f0b78ae270a".
Could not find a cache.
Searching for a cache using the "restore-prefixes-first-match":
["nix-Linux-"]
Lookup only - skipping download
Found a cache using the "restore-prefixes-first-match".
Copying "/nix/var/nix/db/db.sqlite" to "/home/runner/work/_temp/527cec4a-6440-4da1-aa05-ef10e8248d6c/old.sqlite".
Restoring a cache with the key "nix-Linux-b4c8302b1a106303f6bedbc66ceac1efb38adee347673df88edb1b8cf2badb6f".
Logs produced while restoring a cache.
Finished restoring the cache.
Copying "/nix/var/nix/db/db.sqlite" to "/home/runner/work/_temp/527cec4a-6440-4da1-aa05-ef10e8248d6c/new.sqlite".
Merging store databases "/home/runner/work/_temp/527cec4a-6440-4da1-aa05-ef10e8248d6c/old.sqlite" and "/home/runner/work/_temp/527cec4a-6440-4da1-aa05-ef10e8248d6c/new.sqlite"
into "/nix/var/nix/db/db.sqlite".
Error: ENOENT: no such file or directory, open 'src/templates/merge.sql'

Curiously though, the step doesn't actually "fail" in the CI, so the build doesn't break until I try to use nix in a later step:

Run nix develop -c mix deps.get
  nix develop -c mix deps.get
  shell: /usr/bin/bash -e {0}
  env:
    REGISTRY: ghcr.io
    IMAGE_NAME: redacted/redacted
    NIX_CONFIG: experimental-features = nix-command flakes
    NIX_PROFILES: /nix/var/nix/profiles/default /home/runner/.nix-profile
    NIX_USER_PROFILE_DIR: /nix/var/nix/profiles/per-user/runner
    NIX_SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
    NIX_USER_CONF_FILES: /tmp/tmp.LwlP8djW0a/flake-nixConfig.conf:/home/runner/.config/nix/nix.conf:
error: cannot open SQLite database '/nix/var/nix/db/db.sqlite': unable to open database file
Error: Process completed with exit code 1.

Explicitly specifying that I want to use 5.1.0 in my caching step causes the issue to go away.

@deemp
Copy link
Collaborator

deemp commented Apr 1, 2024

Yes, I should've inlined the .sql file into generated JS.

@deemp
Copy link
Collaborator

deemp commented Apr 1, 2024

@Munksgaard, I fixed the problem with .sql in v5.1.2 (worked for me here).

I suggest to discuss another part of your issue in #35

@Munksgaard
Copy link
Author

Thanks for the quick turnaround! And yes, thanks for opening the other issue as well, that definitely weirded me out for a minute :D

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

No branches or pull requests

2 participants