jenkins--application-Plug-ins using--publish over SSH

Source: Internet
Author: User
Tags ssh port ssh server

This article is part of the Jenkins Application system article, most of which comes from work and learning practices, some of which are from official documents and netizens ' articles, which are quoted in the "References" section with original links, such as inadvertent infringement of your rights, please contact qq:46106962, If you need further communication please join QQ Group: (Jenkins Learning Communication) 469536515. Reprint and use please indicate the source.

Dependent environment
    1. SSH, the remote computer to open the SSH service, allow Jenkins to log on the machine through the SSH service to execute the script; you can set SSH to use username/password or login via key, SSH configuration please check the specific information here do not explain
    2. JDK, this article deploys Java applications, the remote machine to use the JDK environment, such as non-Java applications, please ignore
    3. Tomcat or other Web container, this article is to use Tomcat as an example, to deploy the application to tomcat running, the remote machine installed Tomcat is necessary, such as non-Java applications Please ignore, such as using other web containers to find the container installation information
Plug-in Installation   Open the "System Management > Management Plug-in" of Jenkins, select "Optional Plugins", enter "Publish over SSH" in the input box to search, if the search is not available in "installed" to confirm whether it has been installed. Select "Publish over SSH" in the search results, click the "Direct Install" button on the page, the system will be installed automatically, this plugin does not need to restart Jenkins after installation. if the plug-in installation succeeds, the relevant configuration item appears in System Administration > System settings.

Plug-in configuration global settingsafter the plug-in is successfully installed, you need to configure it in System Administration > System settings before
each of these items can be overridden by the SSH server's settings, which has the benefit of eliminating the cumbersome steps that each SSH server can configure separately in the case of a server environment comparison specification.
parameter Description
  • PASSPHRASE:SSH's password
    A password for the user name when logged on with a username/password, and a password for the private key when logged on with the private key.
  • Path to key:ssh private key file paths
    The path to the private key file, either an absolute path or a relative path relative to $jenkins_home
  • Key: Private key
    Text content after the private key is exported

    If both "key" and "Path to Key" are set, the priority of "key" is higher, and the password of the private key is the content set in "Passphrase".
  • Disable exec: Prohibit command execution on the target machine
    The command set in the Exec command option in the job configuration will be ignored when checked. In the documentation for Jenkins, "the Disable exec in the advanced settings for individual configurations would be ignored." Not fully understood, from the actual effect, as long as "Disable exec" is checked, regardless of whether the SSH server check "Disable exec", the command set in the job will be ignored.
Publisher defaultsssh Server ConfigurationSSH server configuration for publish over SSH Cheng configuration, sub-"Basic Settings" and "Advanced settings" two parts; "Basic settings" mainly transport Cheng IP, SSH user name, ssh port, connection timeout time, etc., "Advanced settings" and most "global settings" The options are the same. Each op Cheng used in the job is configured here.
Basic Settings
the basic settings for SSH server are as follows:
This setting is effective in all settings that use "172.16.18.192-ssh", which is equivalent to the global settings of this path SSH node, and is also overwritten in the job based on the same reason as in global settings, which is necessary for remote operation by multiple users. As on the 172.16.18.192 machine, there are UserA and UserB two users to deploy "application a" and "Application B" respectively.
  • parameter Description
    • Name
      The name of the SSH node configuration, which will appear in the drop-down list of "name" in "SSH Server" when using the publish over SSH plugin in the job, such as:

    • Hostname
      Host name or IP of the machine to which the SSH is connected
    • Username
      User name used by the SSH service, username specified for key when connecting using key
    • Remote derictory
      The directory that exists on the transport machine, and the user specified by "Username" has access to this directory, the plugin will transfer the files to this directory.
Advanced SettingsIn the advanced settings, you can set the SSH port, retry time, and reset the options in the global settings, because they are similar, do not repeat the instructions, settings such as:

Configuring the job in Jenkinsin the job settings "Add Build Step" select "Send files or execute commands over SSH", which can be used in the job publish over SSH plug-in, configuration such as:


  • parameter Description
      • Name
        "System Administration > System Settings" to set the name list of SSH sverver.
      • source Files
        Copy to the file on the transport machine, run the expression, such as "**/*.war" in.
      • remove Prefix
        The directory to be filtered when the file is copied, such as the target directory in.
      • remote The directory
        file gets to the directory on the remote machine, which is relative to the "SSH Server" Remote directory will be created automatically if it does not exist.
  • Exec command
    Here you can fill in the scripts executed on the transport machine, such as: application Deployment scripts. Example of applying a shell deployment to Tomcat in:

Resourcesplug-in configuration and use (http://www.cnblogs.com/zz0412/p/jenkins_jj_10.html)
Resolving SSH Certificate issues (http://blog.csdn.net/jiang1986829/article/details/50955359)
plug-in configuration and use (Http://my.oschina.net/yangting880815/blog/417661?fromerr=x1QONbYQ)

jenkins--application-Plug-ins using--publish over SSH

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.