gitjenkinsbitbucketrsyncgoogle-compute-engine

Rsync to Google Compute engine Instance from Jenkins


I want to send files from Jenkins to to my instance in Google Compute engine instance I added a build in my config in jenkins :

rsync -vrzhe "ssh -i /var/lib/jenkins/.ssh/google_compute_engine -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no" . login@Host:/var/www

And I get this error :

Checking out Revision 59cf9dd819fe2168c4c40f716707d58b2b99e251 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 59cf9dd819fe2168c4c40f716707d58b2b99e251
> git rev-list 59cf9dd819fe2168c4c40f716707d58b2b99e251 # timeout=10
[Platform] $ /bin/sh -xe /tmp/hudson4502433356962914860.sh
+ rsync -vrzhe 'ssh -i /var/lib/jenkins/.ssh -o UserKnownHostsFile=/dev/null -o 

CheckHostIP=no -o StrictHostKeyChecking=no' . login@Host:/var/www
   StrictHostKeyChecking=no' . login@host:/var/www
   ssh: connect to host host port 22: Connection timed out
   rsync: connection unexpectedly closed (0 bytes received so far) [sender]
   rsync error: unexplained error (code 255) at io.c(601) [sender=3.0.7]
   Build step 'Exécuter un script shell' marked build as failure
   Finished: FAILURE

Any idea


Solution

  • The problem was with my public key so to solve the problem you need to :

    1 - Setting up your ssh keys : run

    gcloud compute ssh example-instance
    

    2 - cp your .ssh/google_compute_engine.pub content into the GCE VM authorized_key

    3 - restart VM instance

    Thanks for your help