Jenkins 安装 (六) 后端流水线

创建

备注描述内容

构建触发器 (默认)

高级项目选项 (默认)

流水线 (重点)

pipeline {
    agent any

    tools {
        // Install the Maven version configured as "M3" and add it to the path.
        maven "Maven"
    }

    stages {
      stage('Pull Source code') {
        steps {
          script{
                git branch: 'develop', credentialsId: '6d704e40-401f-4f70-9724-0f8fc2ab8be6', url: 'https://gitlab.51qqt.com/qqtmall/qqt-platform.git'
		  }
		}
      }

      stage('Build Project') {
        steps {
          script{
				sh "mvn clean install -Dmaven.test.skip=true -pl qqt-platform-io,qqt-platform-common,qqt-platform-admin -am"
		  }
        }
      }

      stage('ssh push jar') {
        steps {
		    sshPublisher(publishers: [sshPublisherDesc(configName: 'Tomcat02', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''sh /mnt/soft/malls/sh/admin.sh stop
rm /mnt/soft/malls/malls/admin/qqt-platform-admin.log
sh /mnt/soft/malls/sh/admin.sh start''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: 'malls/malls/admin', remoteDirectorySDF: false, removePrefix: 'qqt-platform-admin/target/', sourceFiles: 'qqt-platform-admin/target/*.jar')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
		}
      }
    stage('Clear cache') {
        steps {
          script{
				sh '''cd /mnt/soft/tomact/.jenkins/workspace/Develop_Admin/qqt-platform-admin
rm -rf target'''
		  }
        }
      }
    }
}

上一篇 Jenkins 安装 (五) 前端构建一个自由风格的软件项目
目录
下一篇 Jenkins 安装 (七) 前端流水线