username-removed-1675296 (5dcfe4b6) at 03 Oct 07:55
Update .gitlab-ci.yml
username-removed-1675296 (cb44964c) at 03 Oct 07:55
username-removed-1675296 (e4649a35) at 03 Oct 07:55
username-removed-1675296 (2ccca789) at 03 Oct 07:54
username-removed-1675296 (9932fbe0) at 03 Oct 07:54
I'm still having issues transferring files through ssh/scp with gitlab.ci.
- apt-get update && apt-get -y install openssh-client
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY}" | tr -d ' ' | base64 --decode > private.ssh_key
- chmod 600 private.ssh_key
- cat private.ssh_key
- ssh-add private.ssh_key
- scp -o StrictHostKeyChecking=no -r code/_site/* username@server.com
The private key shows up correctly when cat
ing it, and the console tells me that Identity added: private.ssh_key (private.ssh_key)
, but after a few minutes I see
ssh: connect to host server.com port 22: Connection timed out
lost connection
ERROR: Job failed: exit code 1
running these same exact commands copy and pasted into a docker container work. Do I need to copy in the public key into the gitlab.ci container?
I agree. Secrets configured in Gitlab should be present as k8s secrets.
I guess we need to differentiate
Unfortunately I don't know how to get all Gitlab secrets from the build job to put them into a k8s secret.
Putting the public config into the deployment manifest seems OK for me though.
Seems this makes the variables exist in plaintext in the deployment manifest. Would it be better to add Kubernetes secrets instead, e.g. email/database passwords?
I was facing wired issue. Just try to check / debug whether your GitLab variables give you correct value or not.
In your .gitlab-ci.yml
configuration file print the private key variable.
echo "$SSH_PRIVATE_KEY" > ssh.priv chmod 600 ssh.priv cat ssh.priv
There are chances that the key won't print.
Today I was having issue that all defined gitlab variables somehow does not have any values even if they are defined correctly.
If you found that key is displaying perfectly, then make sure that you provide correct permissions to config, keypairs, authorized_keys file available in .ssh folder of your server. (ex. chmod 600 authorized_keys
)
Hope it helps :)
@marek.urbanowicz hi, it is working, need to add
-----BEGIN RSA PRIVATE KEY-----
xxxxxxx
-----END RSA PRIVATE KEY-----
That's awesome @dzaporozhets! I look forward to trying it out with a few frameworks.
@ayufan We can probably go ahead and merge this, and then work on adding it to Auto Deploy 0.2.0 later.
Tested on dev.gitlab.org by https://dev.gitlab.org/dzaporozhets/test-zero-config-ci/-/jobs/1339098 with
image: registry.gitlab.com/gitlab-examples/kubernetes-deploy:dz-refactor-command-test
test:
script:
- command run-test
only:
- branches
@markpundsack I changed test
to run-test
and refactored repeating code. Please take a look. Should be ready to merge
@markpundsack good point
Let's just go for it and see what happens.
Joshua Lambert (130d8e0c) at 15 Aug 02:49