Giter Club home page Giter Club logo

rustup's People

Contributors

dependabot[bot] avatar dmikusa avatar foresteckhardt avatar

Watchers

 avatar  avatar  avatar

Forkers

morawi-za

rustup's Issues

`rust-toolchain.toml` support

Would it be possible to support for the rust-toolchain.toml?
This would be quite convenient, as you don't need to specify the options for the toolchain also when running pack.
I have one in my repo already so everybody who checks out that repo does not need to bother with setting the correct settings for their toolchain and also the CI runs the tests with these settings then.
For deploying it would also be awesome to have these settings taken from this standardized file instead of specifying them again in a project.toml file.

My project.toml looks like this:

[[build.buildpacks]]
uri = "docker.io/paketocommunity/rust:0.9.0"

[[build.env]]
name = "BP_RUST_PROFILE"
value = "default"

[[build.env]]
name = "BP_RUST_TOOLCHAIN"
value = "nightly"

rust-toolchain.toml

[toolchain]
channel = "nightly"
components = ["rustfmt", "clippy"]
profile = "minimal"

Yes they diverge, but that's not the point of this ticket ๐Ÿ˜‰

`rustup` with musl failing to read `rustc` version

Buildback fails to add a proper version of the rust toolchain.
Command used for building:

pack build image_name \
-b docker.io/paketocommunity/rust \
-B paketobuildpacks/builder:full \
-e BP_RUST_TOOLCHAIN=nightly  \
-e BP_RUST_PROFILE=complete \
-e BP_RUSTUP_INIT_LIBC=musl \
--clear-cache

Note: full and complete where only used for testing.

With musl the error is:

nightly-x86_64-unknown-linux-musl installed - (error reading rustc version)

Building without musl works fine and results in this line instead of the error above:

nightly-x86_64-unknown-linux-gnu installed - rustc 1.60.0-nightly (5d8767cb2 2022-02-12)

Error log:

full: Pulling from paketobuildpacks/builder
Digest: sha256:35a5e9ce46ef2405f7f740c9c35dba732ba05e99549c0d101d8d59f84b023009
Status: Image is up to date for paketobuildpacks/builder:full
full-cnb: Pulling from paketobuildpacks/run
Digest: sha256:8610aaf374a88b9d251d7ad0f463a4ea9bf159df9bccc08289f8e39de92afaaf
Status: Image is up to date for paketobuildpacks/run:full-cnb
latest: Pulling from paketocommunity/rust
Digest: sha256:bddf1870ab670a7fe650a463d6c7b41588254066fbdb04f20ca061fce69fada6
Status: Image is up to date for paketocommunity/rust:latest
===> ANALYZING
===> DETECTING
3 of 4 buildpacks participating
paketo-community/rustup    1.1.2
paketo-community/rust-dist 1.4.1
paketo-community/cargo     0.2.1
===> BUILDING

Paketo Rustup Buildpack 1.1.2
  https://github.com/paketo-community/rustup
  Rustup (musl libc) 1.24.3: Contributing to layer
    Downloading from https://static.rust-lang.org/rustup/archive/1.24.3/x86_64-unknown-linux-musl/rustup-init
    Verifying checksum
    Copying to /layers/paketo-community_rustup/rustup-musl/bin
  Cargo: Contributing to layer
  Rustup: Contributing to layer
    Installing Rustup
  Rust: Contributing to layer
    Installing Rust
      info: syncing channel updates for 'nightly-x86_64-unknown-linux-musl'
      info: latest update on 2022-02-13, rust version 1.60.0-nightly (5d8767cb2 2022-02-12)
      info: downloading component 'cargo'
      info: downloading component 'clippy'
      info: downloading component 'rust-docs'
      info: downloading component 'rust-std'
      info: downloading component 'rustc'
      info: downloading component 'rustfmt'
      info: installing component 'cargo'
      info: installing component 'clippy'
      info: installing component 'rust-docs'
      info: installing component 'rust-std'
      info: installing component 'rustc'
      info: installing component 'rustfmt'
      
        nightly-x86_64-unknown-linux-musl installed - (error reading rustc version)
      
      info: default toolchain set to 'nightly-x86_64-unknown-linux-musl'
      info: checking for self-updates
Warning: the following SBoM files will be ignored for buildpack api version < 0.7 [/layers/paketo-community_rustup/rustup-musl.sbom.syft.json]

Rust Distribution Buildpack 1.4.1
  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 create cargo layer contributor
unable to determine cargo version
error executing 'cargo version':
 Combined Output: error: command failed: 'cargo': No such file or directory (os error 2)
: 
exit status 1
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51

`$BP_RUSTUP_ENABLED` doesn't seem to work

> 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.

Support adding additional targets

When the rustup buildpack runs, it installs the specified Rust tools. It is possible for rustup to install additional toolsets. This is helpful when cross-compiling. For buildpacks, this would be most useful to build a binary that runs on the Paketo tiny stack.

See #42 for details.

The idea would be that after rustup runs for the first time, we'd look at $BP_RUST_ADD_TOOLCHAINS which would be a space-separated list of additional targets for rustup to install. We'd run rustup target add for each specified target.

Add BOM Support

When using Rustup you should get BOM entries for the Rust tools that are installed.

  • rustup-init
  • rustup
  • Rust

Rustup does not run when changing from base to tiny stack

When you build on the base image, it will install Rust for gnu libc. If you switch to the tiny stack, Rustup should run and install Rust with musl glibc. Presently, it does not run.

Rustup (musl libc) 1.25.2: Contributing to layer
Downloading from https://static.rust-lang.org/rustup/archive/1.25.2/x86_64-unknown-linux-musl/rustup-init
Verifying checksum
Copying to /layers/paketo-community_rustup/rustup-init-musl/bin
Cargo: Contributing to layer
Rustup: Reusing cached layer
Rust: Contributing to layer
Installing Rust
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'

This is a caching issue. The cache attributes for the Rustup layer should include the glibc type or the stack so when that changes it will rerun.

What you can do to work around this is to clear the buildpack cache. If you run your next pack build with the --clear-cache flag, that should clear it out and you should see this line go away Rustup: Reusing cached layer. Don't forget to remove that argument on subsequent builds.

Support for Jammy Tiny stack

The stack id for the tiny stack on Jammy has changed.

  1. Review if this is still necessary. If the library for gnu support is now present in Jammy, we may be able to just remove this additional logic and use gnu by default.
  2. If it is still required, then check the new stack id as well as the old ID in comparisons.

Also, include support for the static stack.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.