Skip to content

Cpython buildpack doesn't use url specified in dependency mirror binding #819

@joanna-polec

Description

@joanna-polec

General summary

I'm using dependency mirror feature described here: https://paketo.io/docs/howto/configuration/#dependency-mirrors for building apps in local network. It works fine for Java and Nodejs apps but doesn't for Python.
Builder used: builder-jammy-full:0.3.409

Expected Behavior

Python should be downloaded from URL specified in dependency mirror binding.

Current Behavior

Buildpacks are trying to download Python from default URL: https://artifacts.paketo.io/..

Steps to Reproduce

For purpose of easier testing and reproducing issue, I checked buildpacks behaviour locally with pack build.

1. Create dependency mirror bindings on local file system
mkdir dependency-mirror
echo -n "dependency-mirror" > dependency-mirror/type
echo -n "https://mirror.example.org" > dependency-mirror/default

2. Verify if it's created correctly by running pack on sample node application
pack build --builder paketobuildpacks/builder-jammy-full:0.3.409 --volume /<absolute-path-to-dependency-mirror-dir>:/platform/bindings/dependency-mirror sample-nodejs
As a result I got logs with correct url

[detector] 6 of 10 buildpacks participating
[detector] paketo-buildpacks/ca-certificates 3.8.6
[detector] paketo-buildpacks/node-engine 4.1.12
[detector] paketo-buildpacks/npm-install 1.5.0
[detector] paketo-buildpacks/node-start 2.1.3
[detector] paketo-buildpacks/npm-start 2.0.12
[detector] paketo-buildpacks/procfile 5.9.3
===> RESTORING
===> BUILDING
[builder] target distro name/version labels not found, reading /etc/os-release file
[builder]
[builder] Paketo Buildpack for CA Certificates 3.8.6
[builder] https://github.com/paketo-buildpacks/ca-certificates
[builder] Build Configuration:
[builder] $BP_EMBED_CERTS false Embed certificates into the image
[builder] $BP_ENABLE_RUNTIME_CERT_BINDING true Deprecated: Enable/disable certificate helper layer to add certs at runtime
[builder] $BP_RUNTIME_CERT_BINDING_DISABLED false Disable certificate helper layer to add certs at runtime
[builder] Launch Helper: Contributing to layer
[builder] Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[builder] Paketo Buildpack for Node Engine 4.1.12
[builder] Resolving Node Engine version
[builder] Candidate version sources (in priority order):
[builder] package.json -> "18.x"
[builder] -> ""
[builder]
[builder] Selected Node Engine version (using package.json): 18.20.3
[builder]
[builder] Executing build process
[builder] Installing Node Engine 18.20.3
[builder] failed to fetch dependency: failed to make request: Get "https://mirror.example.org/dist/v18.20.3/node-v18.20.3-linux-x64.tar.xz": dial tcp: lookup mirror.example.org on 8.8.8.8:53: read udp 172.17.0.3:46484->8.8.8.8:53: i/o timeout
[builder] ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51

3. Run the same pack command on sample python application
pack build --builder paketobuildpacks/builder-jammy-full:0.3.409 --volume /<absolute-path-to-dependency-mirror-dir>:/platform/bindings/dependency-mirror sample-python
As a result I got logs with default url

[detector] 7 of 10 buildpacks participating
[detector] paketo-buildpacks/ca-certificates 3.8.6
[detector] paketo-buildpacks/cpython 1.13.10
[detector] paketo-buildpacks/pip 0.22.1
[detector] paketo-buildpacks/pipenv 1.21.6
[detector] paketo-buildpacks/pipenv-install 0.6.23
[detector] paketo-buildpacks/python-start 0.14.19
[detector] paketo-buildpacks/procfile 5.9.3
===> RESTORING
===> BUILDING
[builder] target distro name/version labels not found, reading /etc/os-release file
[builder]
[builder] Paketo Buildpack for CA Certificates 3.8.6
[builder] https://github.com/paketo-buildpacks/ca-certificates
[builder] Build Configuration:
[builder] $BP_EMBED_CERTS false Embed certificates into the image
[builder] $BP_ENABLE_RUNTIME_CERT_BINDING true Deprecated: Enable/disable certificate helper layer to add certs at runtime
[builder] $BP_RUNTIME_CERT_BINDING_DISABLED false Disable certificate helper layer to add certs at runtime
[builder] Launch Helper: Contributing to layer
[builder] Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[builder] Paketo Buildpack for CPython 1.13.10
[builder] Resolving CPython version
[builder] Candidate version sources (in priority order):
[builder] Pipfile.lock -> "3.11"
[builder] -> ""
[builder] -> ""
[builder]
[builder] Selected CPython version (using Pipfile.lock): 3.11.9
[builder]
[builder] Executing build process
[builder] Installing CPython 3.11.9
[builder] failed to fetch dependency: failed to make request: Get "https://artifacts.paketo.io/python/python_3.11.9_linux_x64_jammy_09e182e9.tgz": dial tcp: lookup artifacts.paketo.io on 8.8.8.8:53: read udp 172.17.0.3:56802->8.8.8.8:53: i/o timeout
[builder] ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51

*Please ignore above error (issue is not related to this) - I share logs from local testing where I wanted to check which URL is used by buildpacks. And based on that, I can say that for Python - dependency mirror binding is ignored.

Motivations

We aren't able to build Python apps in environment without internet access. Dependency mapping is not an option in CICD, as it requires to configure direct URL for each artifact (each python version).

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