其他分享
首页 > 其他分享> > jekins用流水线构建运行springboot项目。以码云为例子

jekins用流水线构建运行springboot项目。以码云为例子

作者:互联网

基础配置和上篇博客相同

 

1.项目配置

 

 

 

 

 

 jekinsfile,放在项目根目录

pipeline {
 agent any

 stages {
  stage('拉取代码') {
   steps {
   checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 'mayunusername', url: 'https://gitee.com/majie2018/jekins.git']]])
   }
  }
  stage('编译构建') {
   steps {
    sh label: '', script: 'mvn clean package -Dmaven.test.skip=true'
   }
  }
   stage('构建完成') {
   steps {
    echo '构建完成'
   }
  }
  stage('远程部署') {
   steps {
   sshPublisher(publishers: [sshPublisherDesc(configName: 'local', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'bash /usr/jekins/publish/restart.sh', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/usr/jekins/publish/', remoteDirectorySDF: false, removePrefix: 'target/', sourceFiles: 'target/*.jar')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
   }
  }
 }

}

jekinsfile,使用自带的流水线语法生成

 

 这一步是生成部署项目的语法,运行脚本放在服务器的某个文件夹

 

标签:构建,false,springboot,jekinsfile,云为,steps,jekins,stage
来源: https://www.cnblogs.com/a1304908180/p/14717684.html