Skip to content

Packit does not support absolute file:/// paths for dependency-mapping #591

@paulchambers

Description

@paulchambers

Dependency mapping should allow users to use a local copy of a dependency by specifying an absolute file:/// path to a file mounted into the build. Instead packit always appends a base path to the path specified in the mapping

Expected Behavior

A dependency-mapping with the path failed to fetch dependency: failed to open file: file:///platform/bindings/dependency-mapping/binaries/yarn_1.22.19_linux_noarch_bionic_3235ba55.tgz should look in the given directory

Current Behavior

The packit based yarn buildpack instead gives this error:

failed to fetch dependency: failed to open file: open /cnb/buildpacks/paketo-buildpacks_yarn/1.3.7/platform/bindings/dependency-mapping/binaries/yarn_1.22.19_linux_noarch_bionic_3235ba55.tgz: no such file or directory

Possible Solution

Don't append the base path if the mapping starts with file:/// (a triple slash) (This is the behavior used in libpak based buildpacks)

This comment https://github.com/paketo-buildpacks/packit/blob/d558b87c97641ff5acfe9270248ecdfaaa4e7226/postal/service.go#L244C1-L247C1 suggests there may be buildpacks that expect the current behavior so it may need to append the base path for a non-absolute file URI (eg a double slash)

Steps to Reproduce

build a container using a dependency-mapping with an absolute file path

Motivations

This bug prevented using a local copy of the yarn dependency when deps.paketo.io failed.

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