I'm new to Google Cloud Platform and want to build a deployment pipeline via Jenkins. I have a virtual machine up and running that I connect via SSH button given on the dashboard and do deployments.
Unlike AWS where I get pem file to connect... I don't have a file to connect here. Now, in Jenkins when I want to connect via shell script and deploy latest code on VM - I don't know how to do it.
something like
ssh -i #some-file name:ip
Kindly help as to how can I connect/ssh gcp vm via shell in Jenkins and make deployments. Step by step answer needed. Thanks!
There are still PEM files stored in the VM instance, you can locate them in $HOME/.ssh.
See this stack post about how to retrieve SSH keys on GCE
Related
I am running several remote ssh scripts on machines using jenkins. I would like to get some of the output of the runtime to parse back/process on the jenkins machine/other machine. Is there an easy way to do it, or I need to write to a centralised storage?
Thanks
Jenkin Project - I configure the Build setup in Batch file in below statement
aws s3 cp ./dist/first-ci-project s3://first-ci-cd-project --recursive
but result is
'aws' is not recognized as an internal or external command,
But Command Prompt i run the above command its working good. Pl help me.
Are you running the aws command in a jankins slave? If so please check whether aws cli command tool is installed on the slave and the location of the aws cli is added to the environment variables.
If you are running on the jenkins master, same as above. Please check if you have added the aws cli folder location is added as environment variable under jenkins master.
I had the similar issue, I had make sure that the user with which aws CLI is installed is same as the one which Jenkins is using during the runtime
I am new to Jenkins and existing job uses Execute Shell script on the remote host using SSH in the Build. In the SSH Site, there is a lot of username#ip in the drop-down box so that the developer can select the SSH site and build.
Now, my requirement is to add an IP to the SSH Site. I am not authorized to install plugins. How to add an IP to the SSH Site to the existing set of IP's?
new ssh sites are added from jenkins global configuration under ssh hosts.
Manage Jenkins--> SSH hosts --> Add new site
Hope this answers your questions
You can add SSH remote in latest Jenkins version in this way
Dashboard -> Manage Jenkins -> Configure System -> SSH remote hosts -> Add
I followed tutorial to get Jenkins set up on Windows.
What i have is:
Jenkins running with recommend plugins installed
Jenkins URL changed to http:// my ipv4:8080/
A project with a simple command [echo hi]
For nodes i currently have just the Master node which is tied to my main PC
My goal is have one computer send a command to all the slave PC's so they run a python script i created.
I create a windows VM and connected to the Jenkins server. I logged in with the admin account and created a new node.
I cant find anything useful to help me figure out what to put in launch command. When i launch my node on the VM without the launch command specified, it fails to launch.
Is the batch script i wrote in the project, what's sent to all the slave machines or do I have this all wrong?
Thank you!
EDIT
I got it working thanks to the answer posted here. I wrote up a doc on how i got Jenkins working from installation to deployment. There are other resources out there but i hope this will help someone.
Jenkins Master/Agent Setup
If you want to have the option Launch slave agents via Java Web Start you should specify the TCP port for slaves.
It is done through Manage Jenkins > Configure Global Security > TCP port for JNLP agents. You can select fixed port 50000. More info here.
How to automate Jenkins for Docker Swarm deployment.
I am wondering if there are any plugins available in Jenkins which will help in Docker Swarm deployment or any other alternative way through which we can achieve the automation of Swarm deployment using Jenkins existing plugins?
Fixed this problem by using a plugin called Publish over SSH
Need to install a Jenkins plugins “Publish over SSH”, this plugin will allows us to
Sends files over SSH(SFTP)
Execute commands on a remote server
First step will be to add remote hosts and second will be to add an execution/build step where the commands will be executed
Follow this link for step by step instruction