paketo-community / rustup

A Cloud Native Buildpack that provides Rustup and installs a Rust toolchain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`$BP_RUSTUP_ENABLED` doesn't seem to work

dmikusa opened this issue · comments

> pb rust-example -e BP_RUSTUP_ENABLED=false -b paketo-community/rust
===> ANALYZING
Previous image with name "apps/rust-example" not found
===> DETECTING
paketo-community/rustup    1.1.2
paketo-community/rust-dist 1.4.0
paketo-community/cargo     0.2.1
paketo-buildpacks/procfile 5.0.2
===> RESTORING
===> BUILDING

Paketo Rustup Buildpack 1.1.2
  https://github.com/paketo-community/rustup

Rust Distribution Buildpack 1.4.0
  https://github.com/paketo-community/rust-dist

Rust Cargo Build Pack 0.2.1
  https://github.com/paketo-community/cargo
  Build Configuration:
    $BP_CARGO_EXCLUDE_FOLDERS    static, templates, public, html  folders that should not be deleted and should persist to the generated image
    $BP_CARGO_INSTALL_ARGS                                        additional arguments to pass to Cargo install
    $BP_CARGO_WORKSPACE_MEMBERS                                   the subset of workspace members for Cargo to install
unable to locate cargo home
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51

I haven't dug in more, but it seems like rustup runs and consumes the buildplan entry. Thus rust-dist does nothing and you have no Rust/Cargo installed, so the build fails.

You can work around this by changing the buildpack order, but it was not the intent of the rustup RFC that you would need to do this.

> pb rust-example -e BP_RUSTUP_ENABLED=false -b paketo-community/rust-dist -b paketo-community/rust
docker.io/paketocommunity/rust-dist@sha256:73b371bc19fbc01d58e78fb66c9e959a2b79eadea602f53868361ce79b8ad6f8: Pulling from paketocommunity/rust-dist
ada8b1b600dc: Pull complete
Digest: sha256:73b371bc19fbc01d58e78fb66c9e959a2b79eadea602f53868361ce79b8ad6f8
Status: Downloaded newer image for paketocommunity/rust-dist@sha256:73b371bc19fbc01d58e78fb66c9e959a2b79eadea602f53868361ce79b8ad6f8
===> ANALYZING
Previous image with name "apps/rust-example" not found
===> DETECTING
paketo-community/rust-dist 1.4.0
paketo-community/rustup    1.1.2
paketo-community/cargo     0.2.1
paketo-buildpacks/procfile 5.0.2
===> RESTORING
===> BUILDING

Rust Distribution Buildpack 1.4.0
  https://github.com/paketo-community/rust-dist
  Build Configuration:
    $BP_RUST_VERSION  1.*  the Rust version
  Cargo: Contributing to layer
  Rust 1.58.0: Contributing to layer
    Downloading from https://deps.paketo.io/rust/rust_1.58.0_linux_noarch_bionic_975114ee.tgz
    Verifying checksum
    Expanding to /layers/paketo-community_rust-dist/rust
Warning: the following SBoM files will be ignored for buildpack api version < 0.7 [/layers/paketo-community_rust-dist/rust.sbom.syft.json]

Paketo Rustup Buildpack 1.1.2
  https://github.com/paketo-community/rustup

Rust Cargo Build Pack 0.2.1
  https://github.com/paketo-community/cargo
  Build Configuration:
    $BP_CARGO_EXCLUDE_FOLDERS    static, templates, public, html  folders that should not be deleted and should persist to the generated image
    $BP_CARGO_INSTALL_ARGS                                        additional arguments to pass to Cargo install
    $BP_CARGO_WORKSPACE_MEMBERS                                   the subset of workspace members for Cargo to install
    Creating cached target directory /workspace/target
  Rust Application: Contributing to layer
    File modification times not restored
    File modification times not restored
    File modification times not restored
    cargo install --color=never --root=/layers/paketo-community_cargo/Cargo --path=.
        Installing rust_hello_forever v0.1.0 (/workspace)
         Compiling rust_hello_forever v0.1.0 (/workspace)
          Finished release [optimized] target(s) in 0.42s
        Installing /layers/paketo-community_cargo/Cargo/bin/rust_hello_forever
         Installed package `rust_hello_forever v0.1.0 (/workspace)` (executable `rust_hello_forever`)
  Removing source code

Paketo Procfile Buildpack 5.0.2
  https://github.com/paketo-buildpacks/procfile
  Process types:
    bash-c:   echo 'From Procfile in FS'
    reload:   /opt/watchexec
    run:      /workspace/bin/rust_hello_forever
    run-path: rust_hello_forever
===> EXPORTING
Adding layer 'paketo-community/cargo:Cargo'
Adding 1/1 app layer(s)
Adding layer 'launcher'
Adding layer 'config'
Adding layer 'process-types'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Setting default process type 'rust_hello_forever'
Saving apps/rust-example...
*** Images (e3a5283a7a60):
      apps/rust-example

There seem to be two possible options:

  1. Set the rust-dist and rustup to be optional & have them filtered out at detect time. This would require changes in rust to the composite buildpack and builder, as well as changes here.
  2. Modify build to mark the plan entry as Unmet see example.