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

builder: Fix WORKDIR with a trailing slash causing a cache miss #47723

Merged
merged 2 commits into from
Apr 19, 2024

Commits on Apr 19, 2024

  1. builder/normalizeWorkdir: Always return cleaned path

    The `normalizeWorkdir` function has two branches, one that returns a
    result of `filepath.Join` which always returns a cleaned path, and
    another one where the input string is returned unmodified.
    
    To make these two outputs consistent, also clean the path in the second
    branch.
    
    This also makes the cleaning of the container workdir explicit in the
    `normalizeWorkdir` function instead of relying on the
    `SetupWorkingDirectory` to mutate it.
    
    Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
    vvoland committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    a4d5b6b View commit details
    Browse the repository at this point in the history
  2. container/SetupWorkingDirectory: Don't mutate config

    Don't mutate the container's `Config.WorkingDir` permanently with a
    cleaned path when creating a working directory.
    
    Move the `filepath.Clean` to the `translateWorkingDir` instead.
    
    Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
    vvoland committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    7532420 View commit details
    Browse the repository at this point in the history