jenkins project deployment two

  The first article in project deployment, based on each target server as a node Jenkins, and then pull the code in each node, compilation, packaging, testing, deployment. This has the advantage, when deploying a large number of tasks can be performed simultaneously, without waiting for task execution one by one. Shortcomings, each target host, you need to pull the code, wasted disk space.

  The second way to deploy:

  1) In one Jenkins node, the code for pulling, and then packaged, then the packet to the corresponding server scp.

 

  Let Jenkins avoid dense Login target host:

  1. Jenkins resides in the host, generating a secret key for ssh

    # ssh-keygen -t rsa  

  2. .ssh public directory, scp .ssh services to the target directory under the user directory and rename it to authorized_keys (the file name is fixed)

     # scp id_rsa.pub [email protected]:/home/sto/.ssh/authorized_keys

  3. Jenkins, if you want to log multiple target host, simply copy the public key to the target host can repeat step 2

 

  When Jenkins job creation, in BUILD (building) where module,

    First choose Execute Shell (the local execution shell), then add a Execute shell script on remote host using ssh (remote host shell) option,

  Description: the shell local execution, including packaging, and a packet to the destination host scp

     Remote execution shell, including stopping an application server, replace the new package, start the application server

Guess you like

Origin www.cnblogs.com/licorice/p/11424861.html