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

Unable to pass SSH Private Key as --build-arg #761

Open
slashr opened this issue Sep 2, 2019 · 3 comments
Open

Unable to pass SSH Private Key as --build-arg #761

slashr opened this issue Sep 2, 2019 · 3 comments
Labels
area/usability For all bugs related to how people use kaniko, option and feature flags, etc kind/question Further information is requested priority/awaiting_evidence waiting on user's input before we can close of assign priority stale

Comments

@slashr
Copy link

slashr commented Sep 2, 2019

Actual behavior
I have added my SSH private and public key as secrets inside my Jenkins master. Inside the Jenkinsfile, I fetch these secrets and then pass them to Kaniko using --build-arg pub_key=${JENKINS_SECRET_PUB_KEY} and --build-arg=pub_key=${JENKINS_SECRET_PRIV_KEY}
The public key is passed correctly however I get the following error for the private key:

Error: bad flag syntax: -----END Usage: executor [flags]

The -----END is indicating the end of the private key text. I'm assuming there's some problem with parsing the private key text since it ends like this
...D32UDBw== -----END OPENSSH PRIVATE KEY-----

The = sign at the end might be throwing Kaniko off.

Expected behavior
To be able to pass a SSH private key to the Dockerfile as --build-arg

To Reproduce
Steps to reproduce the behavior:

  1. Pass a private key file text as a --build-arg to a Dockerfile using Kaniko
@tejal29 tejal29 added kind/question Further information is requested priority/awaiting_evidence waiting on user's input before we can close of assign priority labels Sep 27, 2019
@tejal29
Copy link
Member

tejal29 commented Sep 27, 2019

Can you try enclosing the ${JENKINS_SECRET_PRIV_KEY} value in quotes ?

@tejal29 tejal29 added the area/usability For all bugs related to how people use kaniko, option and feature flags, etc label Sep 27, 2019
@tejal29 tejal29 added kind/question Further information is requested stale and removed kind/question Further information is requested labels Jan 10, 2020
@antechrestos
Copy link
Contributor

Maybe it will be solved once this issue will be. You'll only have to reference the argument JENKINS_SECRET_PUB_KEY in your dockerfile and run kaniko with option --build-arg JENKINS_SECRET_PUB_KEY (I do it the same way in gitlab ci so as not to reveal any secret in my .gitlab-ci.yml or build logs)

@lzadjsf
Copy link

lzadjsf commented Oct 3, 2023

I solved it by passing the rsa keys as a base64 string, given docker is expecting a one line command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/usability For all bugs related to how people use kaniko, option and feature flags, etc kind/question Further information is requested priority/awaiting_evidence waiting on user's input before we can close of assign priority stale
Projects
None yet
Development

No branches or pull requests

4 participants