I am trying to edit ssh url of projects in gerrit server - gerrit

I am trying to edit SSH url in gerrit server and set -O in url.
I want to edit ssh url of project

Related

Execute Shell Script on remote host using SSH

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

Jenkins Agent Security

I have 2 questions that Im trying to figure out.
QUESTION 1
I have setup a Jenkins Master and am trying to create a Agent using the UI. Here is the UI snippet.
Now when I click Save and open the Agent, it tells me to use this command to conenct.
java -jar agent.jar -jnlpUrl https://<MASTER_NODE>/computer/Test_node/slave-agent.jnlp
It is not giving me the option to use -secret. How can I enable that feature so that I also need to provide the secret to connect to my master.
QUESTION 2
I am in the process of automating the creation of multiple Jenkins Agents. Im going to do that using REST API calls. The command is
curl -s -k -w %{http_code} -X POST "https://<MASTER_NODE>/computer/doCreateItem?name=jenkins-slave-1&type=hudson.slaves.DumbSlave" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Jenkins-Crumb: ${JENKINS_CRUMB}" \
-d "json=${JNLP_JSON}" )
Now the thing is for every agent, the secret value inside the jnlp file is different. Is there a way to specify that value in the Jenkins Master so that every Jenkins Agent has the same password ?
If you are the jenkins admin, check
1) Manage Jenkins -->Configure Global Security-->Access Control-->Authorization
under Project-based Matrix Authorization Strategy, make sure you have not ticked the Connect options under Agent for Anonymous role.
(or)
2) Make sure Manage Jenkins--> Configure Global Security-->Agents-->Agent protocols has only V4 enabled
JNLP V4 TLS based encryption
As for your second question I do not know. am facing the same issue of how to connect the slaves automatically to the Jenkins Master with different Secrets
JNLP Secrets are derived from the Agent's name. You could get the JnlpMac or secret for a specific agent from the jnlp file or via groovy executed on the master. See for example How to find JNLP Node's secret key remotely?
You can add jenkins-slave.exe and jenkins-slave.xml in Remote root directory which contains jre argument this need a secret key. Secret key only needed when you are setting agent as windows service.
I have followed instruction in LINK

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

Configure proxy setting in a particular Jenkins Job

I have installed Jenkins in a Unix Machine which is behind the proxy server. I have an SVN url which is hosted in Internet. I have enabled all firewall settings and from my server end , I can able to access the SVN url by providing my proxy server details. I have created a Jenkins Job, and installed SVN plugin also. Now i need to pass proxy url to that particular job, so that Jenkins can access the SVN url and checkout the code.
You could set the proxy url in a Global property in Jenkins (like PRIVATE_PROXY_URL) and, in the context of your job, copy the value of that property to the HTTP_PROXY variable or wherever you need it so the SVN plugin will be able to access it.
Another option would be to pass the URL as a Job parameter.
Regards,

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

Resources