LPGhatguy / aftman

Aftman, the prodigal sequel to Foreman
MIT License
157 stars 16 forks source link

Arm64/aarch64 binaries don't get prioritized over x86 #33

Closed filiptibell closed 1 year ago

filiptibell commented 2 years ago

Just noticed that aftman chose the wrong binary when installing one of our internal tools:

CleanShot 2022-09-13 at 18 29 28@2x

In the screenshot you can see that the files downloaded are definitely x86 while the architecture I'm using is arm. If I delete the x86_64 binary from the release aftman correctly picks the aarch64 one.

I'm thinking something might be going wrong during artifact selection / ordering

LPGhatguy commented 2 years ago

I think we're relying on the Ord implementation of Architecture for this. The hope is that on systems that support AArch64 AND x86-64, we should pick AArch64. The opposite might be happening?

This is obviously not a great way solution as it makes this code very hard to debug.

At some point we should pull this code out so we can write better tests for it.

filiptibell commented 1 year ago

I think we're relying on the Ord implementation of Architecture for this. The hope is that on systems that support AArch64 AND x86-64, we should pick AArch64. The opposite might be happening?

Did some diagnosing of this issue and when running locally it actually picked up the correct artifacts, the issue seems to be a missing --target flag during the release build. Basically, std::env::consts::ARCH was set to x86_64 even for aarch64 builds since that's what github's hosted runner is using, and rosetta magic made aftman still work for macOS. I'll make a quick PR to fix it.