Jenkins + git continued deployment

 

jenkins + github continued deployment - curtain

jenkins + github continued deployment
 
  • Start Jenkins
    • java -jar / xxx path /jenkins.war
  • New Task
    • Enter a name for the task casually named
    • Select maven project to build a
      company which generally opt for this
    • Click OK
      After clicking OK will jump to a detailed page
    • Description Option can not write write
    • Find source code management options git
      git or svn determined by the company's own warehouse
    • Configuration repository path
      input at your git repository url address to add a server in credentials at your user information to add branches to build at the Branch generally added * / master that is the main branch
    • Build
      because maven task is created, so there will be at Root POM at a maven pom.xml fill command Goals and options at install
    • Click Apply
      above operations can be achieved compiler package, but can not remote deployment
    • jenkis workspace in the workspace
      , whether saved from a remote repository git or svn server code that will pull in the workspace directory
  • Publishing tasks
    • System Management - System Settings --publish over ssh
      • passphrase: Password remote server
      • SSH Servers:
        • 1.ssh server name: just fill (the purpose of identification)
        • 2.hostname: Remote Host IP
        • 3.username: Log in starting a virtual machine user name
        • 4.remote directory: publishing, files can be copied to a directory
        • 5.Test connection: If successful, the configuration was not a problem
        • 6.apply: Then save
    • Select an item - Configure --post steps
      • 1.选择send files or execute commands over ssh
        • name:默认会选中你全局设置中的ssh服务器
        • transfer set source files:war包的路径
        • remove prefix:移除掉前缀,获得包名
        • exec command:执行指定路径下的shell脚本
          # shell脚本实例
        • # 导出 java环境变量
        • export JAVA_HOME=/usr/local/jdk1.8.0_151
        • # 切换到tomcat的bin目录
        • cd /usr/local/apache-tomcat/bin
        • # 关闭tomcat
        • sh shutdown. sh
        • # 休息​10秒
        • sleep 10
        • # 启动tomcat
        • sh startup. sh​​​​​​​​​​
  • 自动部署思路
    • 实现开发一提交代码就自动部署思路
      • 可以去github或者自己搭建的git远程仓库配置一个钩子
        钩子的作用是一旦检测到开发push代码就会自动启动jenkis持续集成

ps:以上内容是在b站看视频整理的笔记,还未完善。

Guess you like

Origin www.cnblogs.com/ze-yan/p/11406968.html