Closed przemeklal closed 12 months ago
One more comment: the ssh private key must have a new line character at the end, otherwise git-sync will complain about the invalid format of the key and the action will fail. The typical workflow of juju config git_ssh_key=@id_rsa
doesn't work, you need to cat the file, enter a newline manually and pass it to juju.
Bug Description
I faced multiple issues trying to enable sync from a private repository.
Now the following issues were encountered after fixing the above with
juju ssh
workarounds (all commands listed below).Additionally, there's no validation of the private key, after setting the option value using
=$(cat id_ecdsa)
results in a file without a newline at the end, using the=@id_ecdsa
syntax works. Because of that, the sync action may also fail as it will report that the key file has an invalid format.To Reproduce
Deploy:
Try to sync:
Reset the config option and set it to the same value again.
Attempt to sync again, the key is there now but the action fails again:
Created empty known_hosts file manually in an attempt to work this around:
Synced again, this time it failed on
Host key verification failed.
I assumed git-sync prompts to accept the remote key so I ran the same command via
juju ssh
:It did and I typed
yes
:It failed again after that:
The private key file created by the charm has incorrect permissions 0644 instead of 0600.
I changed permissions manually using
juju ssh
to work this around:Tried the sync again and it finally worked:
Environment
COS Lite on top of microk8s, charm from
latest/edge
.Relevant log output
Additional context
No response