stoplightio / spectral

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v3.1, v3.0, and v2.0 as well as AsyncAPI v2.x.
https://stoplight.io/spectral
Apache License 2.0
2.35k stars 226 forks source link

fix: Generated Assets suffix for CPU Architecture x64 is not correct #2626

Closed Vad1mo closed 1 month ago

Vad1mo commented 1 month ago

The generated release assets contain a CPU architecture suffix x64 that is not usable (for automated processing)

Example:

image

In all cases, x64 is not a correct suffix for a CPU architecute. It can not be used to determine the right architecture.

Example for correct X86 64 bit architecture is AMD64

root@np2-4efec-bthtl:/# dpkg --print-architecture
amd64
root@np2-4efec-bthtl:/# uname -p
x86_64
root@np2-4efec-bthtl:/# lscpu
Architecture:            x86_64

ARM64 in M2

root@b4d451187ea2:/# dpkg --print-architecture
arm64
root@b4d451187ea2:/# uname -p
unknown
root@b4d451187ea2:/# lscpu | grep Architecture
Architecture:                       aarch64

Because in automation tools and workflows, often dpkg --print-architecture is used (see here) Example, Dockerfile

RUN curl -fsSL -o /usr/bin/spectral https://github.com/stoplightio/spectral/releases/download/$SPECTRAL_VERSION/spectral-linux-$(dpkg --print-architecture) && chmod +x /usr/bin/spectral

I suggest to generate the Assets with the amd64 for the x86 64 bit architecture.

rainum commented 1 month ago

Hi @Vad1mo,

First of all, thank you very much for your contribution to https://github.com/stoplightio/spectral/pull/2627. We appreciate any participation!

Hover, after doing some research, our team came to the following conclusions:

To not leave you without any solution to your problem there are some good examples in the search list that you provided on how to add branching to your Dockerfile:

https://github.com/raveberry/raveberry/blob/7b7380599b55a9422dc71b9e427c0abefc6838e7/docker/dependencies.Dockerfile#L9-L17

Thanks for creating an issue along with the PR! Let us know if you have any questions.

Vad1mo commented 1 month ago

I see thank you for the detailed explanation.