build: Use normalized platform spec for ARG expansion#66
build: Use normalized platform spec for ARG expansion#66chmeliik merged 2 commits intokonflux-ci:mainfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
chmeliik
left a comment
There was a problem hiding this comment.
Isn't DefaultSpec() always normalized? I think Normalize() is more for user input.
I didn't find the normalization anywhere. I encountered this while running integration tests, and the platform variant was part of the TARGETPLATFORM/BUILDPLATFORM string: Test Failure: image label: BUILDPLATFORM=linux/arm64; containerfile label: BUILDPLATFORM=linux/arm64/v8So the normalization removes the |
Ah, interesting. In that case yeah, normalization makes sense. Could you also submit a similar patch to https://github.com/konflux-ci/dockerfile-json/ (the dev branch)?
I think the condition will have to be more specific and also expect empty for arm64 v8. Because the variant label should apparently be empty on arm64 v8 but not any other arm variant |
Only for the arm64? |
If I understand the normalization correctly, then yes. We expect empty VARIANT if:
|
The ARG variables for multi-platform builds should use a normalized platform spec. This ensures consistent formatting across different platform string representations, particularly for edge cases like architecture normalization. -- https://github.com/containers/buildah/blob/c97d402ccd8dbc5442c3b9fd952fece3f22fbce4/internal/util/util.go#L44 https://github.com/containers/common/blob/a5ccdae846b629b5ceaefa6ffd5c6511409c3487/libimage/platform/platform.go#L20 Signed-off-by: Michal Šoltis <msoltis@redhat.com>
After normalization, the variant will be empty in most cases (including ARM/v8 architecture). We can proceed without conditioned check and just expect imageLabel to equal to containerfileLabel as for other labels even if it is an empty string. Signed-off-by: Michal Šoltis <msoltis@redhat.com>
No description provided.