Jenkins SSH Agent Plugin shows empty drop down in Jenkins Job - jenkins

I am using SSH Agent Plugin version 1.17 with Jenkins version 2.190.3
When I create credentials using
Jenkins -> Credentials -> System -> Global credentials (unrestricted) -> Add Credentials
But when I create jenkins job type Freestyle project, I don't see credentials in ssh agent drop down.
Please advise what I am missing
Ref:
https://wiki.jenkins.io/display/JENKINS/SSH+Agent+Plugin
https://support.cloudbees.com/hc/en-us/articles/360029470091-How-to-use-the-SSH-Agent-Plugin
Jenkins plugin ssh-agent showing "ERROR: Failed to run ssh-add"
Update:
Issue is open for credentials (username/password) https://issues.jenkins-ci.org/browse/JENKINS-59807
but good thing is that it works with private key :)

You have to select Kind as SSH Username with private key to be able to specific use credentials in ssh agent:

Related

Use parameters to connect over ssh in jenkins pipline

I am trying to program a pipeline that requests a username and password as parameter to connect via ssh to a linux server.
I have searched the internet for solutions but the SSH Agent plugin only works with credentials stored in Jenkins.
Is it possible to create a credential with the parameters sent by the user that executes the pipeline or use them as credentials?
Thanks!

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 Options missing while entering a private key; "from a file on jenkins master" and "From the Jenkins master ~/.ssh"

I have set up a new Jenkins Server and copied the Jobs and plugins from the old Jenkins Server, but stragely there are 2 Options missing while entering a private key for the global User/Account. The Options are "from a file on jenkins master" and "From the Jenkins master ~/.ssh".
I doubt that there is some plugin missing, as I have copied all the plugins from old Server. Any clue will be helpful.
These options was removed due to security reasons since version 1.14 of SSH Credentials Plugin:
SSH Credentials Plugin no longer supports SSH credentials from files on the Jenkins master file system, neither user-specified file paths nor ~/.ssh. Existing SSH credentials of these kinds are migrated to "directly entered" SSH credentials.

Use ssh credentials in jenkins pipeline with ssh, scp or sftp

I want to use scp/ssh to upload some files to a server. I discover that I need to use certificate-based authentication, but the question is how? Really what I want to do is to use the same sort of credentials I use with git - passworded ssh cert stored in Jenkins. However, I can't work out how to - the snippet generator has no obvious option for that.
What do others do? Is there an undocumented feature that would do this?
withCredentials([sshUserPrivateKey(credentialsId: "yourkeyid", keyFileVariable: 'keyfile')]) {
stage('scp-f/b') {
sh 'scp -i ${keyfile} do sth here'
}
}
Maybe this is what you want. Install Credentials Plugin and
Credentials Binding Plugin. Add some credentials and then you will get "yourkeyid", bind this credentials to keyFileVariable, passphraseVariable etc.
More details and documentation can be found on the Github site of the Jenkins Credentials Binding Plugin, Credentials Binding Plugin docs, Credentials Plugin, SSH Pipeline Steps plugin
If you install the SSH Agent plugin you can use the ssh-agent pipeline step to run a shell script with an ssh-agent active. The ssh-agent takes a Jenkins credentials ID (a passworded ssh cert, like the one you have for git).

Gitlab integration with Jenkins

I have a paid GitLab account where i store my software-project. I have installed Jenkins on my home PC. I have a Jenkins-project configured to build my software-project.
I don't know how to configure Jenkin's and my GitLab account so that Jenkins can
get the latest source of my software-project from my GitLab account.
Any help will be appreciated.
Note: I know what to do once the source code is downloaded from GitLab
Regards
Juby
You can use the Gitlab Jenkins plugin to configure Gitlab in your Jenkins Gitlab Jenkins plugin
otherwise you can create a jenkins Global Credential
user name : gitlab-ci-token
password : the token of your account you find it in the gitlab :
Profile Settings > Account > private token

Resources