Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kaniko doesnt support Variant label for images #992

Open
PhoenixMage opened this issue Jan 23, 2020 · 3 comments
Open

Kaniko doesnt support Variant label for images #992

PhoenixMage opened this issue Jan 23, 2020 · 3 comments
Labels
area/behavior all bugs related to kaniko behavior like running in as root in progress kind/bug Something isn't working priority/p3 agreed that this would be good to have, but no one is available at the moment.

Comments

@PhoenixMage
Copy link
Contributor

PhoenixMage commented Jan 23, 2020

Actual behavior
When using kaniko on an armv7 instance kaniko seems to use the armhf architecture.
If I use docker build then armv7 is correctly used.

Expected behavior
Kaniko should use the armv7 architecture.

To Reproduce
/kaniko/executor -f Dockerfile --no-push
gives armhf
docker build
gives armv7

Additional Information

  • Dockerfile
FROM alpine:3.11
RUN apk update --print-arch
Description Yes/No
Please check if this a new feature you are proposing
Please check if the build works in docker but not in kaniko
  • - [Yes ]
Please check if this error is seen when you use --cache flag
Please check if your dockerfile is a multistage dockerfile
@PhoenixMage
Copy link
Contributor Author

PhoenixMage commented Jan 23, 2020

Seems runtime.GOARM doesnt exist, goarm is a private symbol which you can access using "unsafe"

My thoughts were to set a symbol at compile time using the linker but I lack the skills to implement that.

@cvgw cvgw added area/behavior all bugs related to kaniko behavior like running in as root kind/bug Something isn't working priority/p3 agreed that this would be good to have, but no one is available at the moment. labels Jan 23, 2020
@tejal29
Copy link
Contributor

tejal29 commented Jan 23, 2020

We did merge a #980 which prefers platform you are currently running on.
I tried adding Variant to goarm, however i got this error

import (
  _ "unsafe"
)

var (
	goarm uint8
)
func currentPlatform() v1.Platform {
	return v1.Platform{
		OS:           runtime.GOOS,
		Architecture: runtime.GOARCH,
+		Variant: string(goarm),
	}
}

However, i got this error so not sure if adding the Variant is the right way.

/ # /kaniko/executor -f dockerfiles/Dockerfile_test1 --context=dir:///workspace --destination=gcr.io/tejal-test/test --tarPath=image.tar
INFO[0000] Resolved base name ubuntu:latest to ubuntu:latest 
INFO[0000] Using dockerignore file: /workspace/.dockerignore 
INFO[0000] Resolved base name ubuntu:latest to ubuntu:latest 
INFO[0000] Retrieving image manifest ubuntu:latest      
ERRO[0001] Error while retrieving image from cache: ubuntu:latest no child with platform amd64/linux in index index.docker.io/library/ubuntu:latest 
INFO[0001] Retrieving image manifest ubuntu:latest      
error building image: no child with platform amd64/linux in index index.docker.io/library/ubuntu:latest

@tejal29
Copy link
Contributor

tejal29 commented Jan 23, 2020

Forgot to mention,
I modified the Makefile to retrieve GOARM from the current platform i am building on.
However it is empty

tejaldesai@@kaniko (507)$ make && docker cp /usr/local/google/home/tejaldesai/workspace/kaniko/out/executor c765d295c9cb:/kaniko
GOARCH=amd64 GOARM= GOOS=linux CGO_ENABLED=0 go build -ldflags '-extldflags "-static" -X github.com/GoogleContainerTools/kaniko/pkg/version.version=v0.16.0 -w -s  ' -o out/executor github.com/GoogleContainerTools/kaniko/cmd/executor
tejaldesai@@kaniko (507)$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/behavior all bugs related to kaniko behavior like running in as root in progress kind/bug Something isn't working priority/p3 agreed that this would be good to have, but no one is available at the moment.
Projects
None yet
Development

No branches or pull requests

3 participants