Jenkins SSH remote script output - jenkins

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

Related

Jenkins call script after build success

I want to Jenkins call a shell script from another docker container.
I don't know Jenkins can do this, and what is the best way to make it.
In one machine, I have this containers:
Service
IP (Docker network)
Note
ERP system
172.74.42.2
Odoo 14 ERP system what work with many plugin. If a plugin got new functions or fixes some bugs, need to restart the system after the pull, then update the plugin.(I write a shell script what run in ssh after push commits.
Jenkins
172.74.42.3
In here I want to call the shell script after the build is success
The Jenkins is work. So the connect between the github and jenkins is good.
I try to write shell commands in Jenkins file. But I think this is a dumb way...

Jenkins deployment on GCP VM via shell script

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

How to send build artifacts over ssh using Jenkins pipeline

I was using Freestyle project method for configuring jobs in Jenkins. I have used Publish Over SSH plugin to send war file to remote system. Now i moved to pipeline configuration. I would like to know how can i do the same in pipeline configuration. Can anyone tell how to write pipeline script for publish over ssh?
Any help would be greatly appreciated.
You can use the raw Unix command scp, as described there : Example syntax for SCP. scp is Unix utility for secure copy... over SSH, which is exactly what Publish Over SSH uses behind the scenes !
Example :
scp your_username#remotehost.edu:foobar.txt /some/local/directory

How to securely backup Jenkins configuration?

I am setuping a Jenkins environment to manage workflows of Python projects. This Jenkins install is running on a Windows 7 machine and I need to backup the Jenkins config to avoid potential loss of work in case of HDD failure (for example).
I tried the SCM sync configuration plugin but this one is not compatible with the Subversion plugin I use and caused Jenkins to display only a white screen when I activated it. So it is not usable.
I also tried the thinBackup. It works well but, due to Jenkins being ran as a local service, it is not able to save backups on a network drive (and backuping on the same drive than Jenkins is not very insteresting). You would think that I just have to run Jenkins with a network user, but in this case it would not have sufficient local privilèges.
I am thinking about creating a Batch (or Python) script which could deal with SVN to backup the Jenkins configuration by adapting what is described in this page but I am not very happy to write a SVN account password in a Batch (or Python) script which could potentially be seen by anybody.
So I would know if it exists an other way to achieve this Jenkins configuration backup.
Or at least, does it exists a way to perform svn commands without showing anybody a clear password?
The issues with the SCM sync configuration plugin sadden me, too. What we do with our Jenkins instances, is: we use thinBackup to run regular backups and store them in the default folder on the same HDD. Then we have a daily cron job rsync them with a folder on another HDD. So if Jenkins is running on Windows, you would probably achieve the same using the Windows Task Scheduler and cwRsync, for example.

Pull file/dir from remote machine Jenkins plugin

I want to pull file or directory from a remote linux machine to Jenkins machine. Is there any Jenikns plugin available?
I am using one plugin "Publish Over SSH" and I am able to transfer files but not receive. I don't want to write/expose password to scp command line. Please suggest a way.
probably you're looking for this https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin
You may not need to expose the credentials in the script. You can manage those in jenkins and pass them as parameters which can be hidden in log. Refer the links below.
https://wiki.cloudbees.com/bin/view/Jenkins+Enterprise/InjectingSecrets
https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

Resources