balena-io-examples / balena-rust-hello-world

Example of how to deploy Rust code on a balena supported device.
https://www.balena.io/docs/learn/getting-started/raspberrypi3/rust/
Apache License 2.0
20 stars 8 forks source link

Specifying Rust version does not seem to have an effect #14

Closed cyplo closed 6 years ago

cyplo commented 6 years ago

The version set currently in Dockerfile.template is 1.29.2. In the logs I'm seeing

[Info]     Starting build for raspi, user gh_cyplo
[Info]     Dashboard link: https://dashboard.resin.io/apps/1277499/devices
[Info]     Building on arm02
[Info]     Pulling previous images for caching purposes...
[Success]  Successfully pulled cache images
[main]     Step 1/27 : ARG rust_revision="1.29.1"

1.29.1 is the previous version - is this expected ? Then in the logs much later:

curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- -y --revision=${rust_revision}                                                                         
[main]      ---> Running in 279ebc163fe4                                                                                                                                                      
[main]     rustup: gpg available. signatures will be verified                                                                                                                                 
[main]     rustup: downloading manifest for 'stable'                                                                                                                                          
[main]     rustup: downloading toolchain for 'stable'                                                                       

it should be 1.29.2 instead of stable - it seems to be ignoring the version number altogether maybe ?

cyplo commented 6 years ago

cc @majorz

majorz commented 6 years ago

It is very strange that you see ARG rust_revision="1.29.1" reported on push. Let's try to find out more about this as this would be a bigger issue I think.

majorz commented 6 years ago

@cyplo I am not reproducing that behavior. Could it be that you had a Dockerfile.armv7hf that was used instead in the same folder?

cyplo commented 6 years ago

Not sure - I saw this behavior when testing #13 - did a singular git push to a repository of an application that already contained the previous version of the example. Could it be the cause ? E.g. some cache being spoiled @majorz ?

zrzka commented 6 years ago

I spent almost 2 days with the caching and I've found that it's hard to make it working when I constantly change Dockerfile, etc. I ended up testing it via new app id & project every single time I made bigger changes to avoid any backend issues. It worked. This leads to an idea that smth can be wrong much deeper. Just thinking aloud.

majorz commented 6 years ago

Oh, I wrote a message here, but now I see I did not post it and is lost :/

I think the Rust caching should not be an issue. It looks quite solid and shrinks the downloaded image on the device very nicely + does the dependency caching which is really nice!

It looks like we are using an older rustup link and also the argument is now different. That should at least solve the reported problem.

cyplo commented 6 years ago

I would like to take a look into this as a part of the Friday project - this Friday.

cyplo commented 6 years ago

I'm playing with possible solutions right now - thinking of showcasing standard rust-toolchain file usage in the example.

zrzka commented 6 years ago

@cyplo go with rust-toolchain. I'd like to see it everywhere if specific Rust version is required.