Jenkins Host key verification failed to deploy - jenkins

i have project jenkins to deploy to my remote server, my local machine and my remote server was connected with ssh but when i try to build job on jenkins, i am getting error like this
image

Login on your jenkins and then try to connect manually on the command line with ssh from jenkins to the remote server. Then approve the host key of the remote system. Run again your job. Then I think everything should be fine.

Related

copying artifact to remote machine using jenkins-pipeline

I have running jenkins in windows machine, i have create build there and artifact is ready, But how can i transfer that artifact to remote machine. I have ssh key and user-id only.(need to be trafered over ssh)
You can use SCP plugin to upload files.
Also, you may need to setup ssh client on your windows host.

Jenkins won't deploy - SSH server 'Host key Verification failed'

I'm deploying an app from git to a target server with Jenkins. I've set in my project a new Jenkinsfile which its stage('deploy') is pointing at the right machine. The conection would happen through SSH.
I've been reading for the deployment to succesfully run, both machines (git & target server) must know each others Host keys, which are stored in known_hosts at ~/.ssh/ . Therefore I connected through ssh from the git machine to the server (prompted if I wanted to continue establishing the connection, 'yes'):
checked the known_hosts file in git server to find the target server entry.
checked the known_hosts file at target server to find an entry, which looks like |1|KCIHm6...lo= ecdsa-sha2-nistp256 AAAA...(bla bla).
I think it's all set for Jenkins to be able to deploy on server, but everytime I build the project from Jenkins, the moment the first ssh deploy command is ran, the deployment fails with a 'Host key Verification failed' message. I can navigate through the target server no matter if I connect through my local machine or the git server, I've tried redoing the process but I can't really replicate the first connection.
Any suggestion is appreciated. Thanks in advance.
Create the ssh keys with jenkins user and restart jenkins.
su jenkins
ssh-keygen
ssh-copy-id destUser#destServer #Type the destUSer password
More info here

How to deploy a jar on Windows server through Jenkins job?

We have a jenkins job which is getting triggered after every push to gitlab.
It creates a build. Upon successful build we want to copy the jar to some Windows server.
We are able to set SSH credentials for Linux server. How do we do it for Windows server.
Thanks
Install the slave on windows machine & trigger the .bat file through jenkine's job.

Getting error in SCP plugin in jenkins

I want to deploy my created war automatically to /tomcat/webapps from jenkins scp plugin.
In jenkins ->Manage Jenkins ->configure system
Hostname-deploy port-22 repository- "ipaddress:8080"/usr/bin/scp
Username-jenkins
Error here "Cant connect to server"
password-jenkins
In jenkins->new job ->configure
scp site - deploy
file to upload
source - http://"ip:8080"/var/lib/jenkins/workspace/WebWarDemo/source/**
destination - http://"ip:8080"/usr/share/tomcat6/webapps/
above is my configuration for scp plugin but i am getting error in first configuration as shown.
but when i tried to run the another error is "jenkins scp com.jcraft.jsch.jschexception auth cancel" i tried so many times changing user name no effect plz suggest anything
I am entering username and password of jenkins server user.
Make sure of the following things:
The user with which you are trying to connect to Repository server has "WRITE" access.
SSH connection has been established between the twos servers with public keys of the respective users
Login to jenkins as jenkins user and run the following
ssh repouser#repository server
What do you get?
Let me know if you have ensured these. Will take it ahead from there

is it possible to stop manually dev server from jenkins

my dev server is installed in jboss aplication server(linux). is it possible to stop manually dev server from jenkins. whenever developer wants depolyment at that time only i have to stop server and deploy artifacts in to dev server.All these operations is possible from jenkins.i already have scripts to stop and start the server. But i dont know how to configure in jenkins.
If your jenkins is also on linux, use "Execute shell" build step and in there connect to your server and execute command:
For example:
ssh user#server "remote_script_command"

Resources