We’ve been running snapcraft pack --use-lxd --debug --verbosity=debug
and seeing rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured
error at the point it tries to run craftctl default
. As a result, our artifact is then named audited-<build-hash>
. Is there a convenient way to provide a specific version or some other resolution of this error?
Welcome @abbaahmad50
I’ve specified the version of rust by using a rust-toolchain
file:
[toolchain]
channel = "1.76.0"
components = [ "rustfmt", "clippy" ]
.
├── Cargo.lock
├── Cargo.toml
├── rust-toolchain
├── snap
│ └── snapcraft.yaml
├── src
└── tests
and also by adding rust-channel
to my snapcraft.yaml
:
parts:
my-part:
plugin: rust
rust-channel: "1.76.0"
Here are a couple of links with useful information:
- https://snapcraft.io/docs/rust-plugin, specifically this part
If a rust-toolchain file is detected, the toolchain it specifies will be used by default. However, if
rust-channel
orrust-revision
are set, the rust-toolchain file will be overridden. - Toolchains - The rustup book
Best regards
Daniel
@DWD Daniel, thanx for replying here =)
I think our challenge is that the snap name is being set to “audited” which we so far can’t figure out how that happens.
Can you share your snapcraft.yaml
?
I’m seeing ProjectVar being set from “snapcraft pack --debug --verbosity=debug”
project_vars={‘version’: ProjectVar(value=‘audited-d5160c1’, updated=True)
2024-07-01 16:18:59.124 :: 2024-07-01 16:18:53.275 execute action polkadot:Action(part_name='polkadot', step=Step.PULL, action_type=ActionType.SKIP, reason='already ran', project_vars={'version': ProjectVar(value='audited-d5160c1', updated=True), 'grade': ProjectVar(value='stable', updated=False)}, properties=ActionProperties(changed_files=None, changed_dirs=None))
Why is the project changed from “polkadot” → “audited”
… and I also see this:
2024-07-01 16:18:59.126 :: 2024-07-01 16:18:54.275 Pack command: ['snap', 'pack', '--filename', 'polkadot_audited-d5160c1_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]
Hey @lonroth
-
Looks like you’re working on this commit.
-
Looks like you’re setting the project version to include a commit tag and the commit hash
craftctl set version=“$(git describe --tags --abbrev=10)-$(git rev-parse --short HEAD)”
See the audited tag
I recommend you change the version in your snapcraft.yaml to see if you can get back to the expected name:
craftctl set version="1.13.0"
I appreciate you’re automating the version for ease, but for now I suggest proving/disproving my reasoning
Thanx @DWD !
I’m trying to understand why the snapcraft.yaml : “source-tag: polkadot-v1.13.0” gets translated into the audited tag whereas the actual tag: GitHub - paritytech/polkadot-sdk at polkadot-v1.13.0 actually exists.
I’m trying your suggestion now which I think likely will work, but its going to take some time for the pack to finish.
The source code is checked out at the tag specified by source-tag
, but the “user facing” version of the built snap is set by [version](
Snapcraft top-level metadata | Snapcraft documentation) or as in your case by setting adopt-info
and using craftctl set version= ...
. So you’re actually setting the project version to something you potentially didn’t expect.
I just rebuilt one of my snaps mysnap
having set
craftctl set version="audited-123456"
The generated snap is now called mysnap_audited-123456_amd64.snap
, instead of mysnap_1.4.0_amd64.snap
or whichever version it actually is.
Totally. I’m waiting for the pack to complete now and then I’ll just publish tomorrow.
We are looking at ways to improve the CI/CD of this snap…
@DWD Thanx alot for your help here.
It was as you said, the explicit naming which caused this to happen and I’ve changed the versioning scheme some for the snap now which looks more like what other snaps uses.
I’m going through some testing now and will release to beta and candidate today.
You’re welcome @lonroth, I’m glad it’s fixed!
I automate the reading of the version information from my cargo.toml
to avoid git tag issues. That might be appropriate/ easy for you as well.
grep -E '^version\s*=' Cargo.toml |
grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' |
head -n 1