Skip to content

Mix git deps do not play nicely with CI caches #14425

Closed
@lukaszsamson

Description

@lukaszsamson

Elixir and Erlang/OTP versions

1.18.2

Operating system

linux

Current behavior

When changing locked refs in git dependencies CI cache often leads to failing builds that need manual intervention and cache busting.

In my case I'm using CircleCI build pipeline with cache on

  • /home/circleci/project/_build/test
  • /home/circleci/project/deps

In this particular case switching dep version

  "salad_ui": {:git, "https://github.com/bluzky/salad_ui.git", "38065ed44b7705964c5acbd2fe0d9dc70330e8e2", []},

to

  "salad_ui": {:git, "https://github.com/bluzky/salad_ui.git", "1fb404637c872501ae781505160a3bc51031e5f5", [branch: "v0"]},

lead to untracked files in the dep working tree

mix deps.get
...
* Updating salad_ui (https://github.com/bluzky/salad_ui.git - v0)
error: The following untracked working tree files would be overwritten by checkout:
        .envrc
        flake.lock
        flake.nix
Please move or remove them before you switch branches.
Aborting
** (Mix) Command "git --git-dir=.git checkout --quiet 1fb404637c872501ae781505160a3bc51031e5f5" failed

Expected behavior

Mix could be more aggressive in overwriting cached deps. When checkout fails it could run git clean -fd.
I think the current behaviour is safer and should stay the default one. The aggressive one could be enabled by a flag, e.g. mix deps.get --ci

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