当前位置: 首页 > news >正文

jenkins配置流水线

新建任务,随便选一个名字,选中流水线
在这里插入图片描述

配置git的用户名和密码,记录ID,后面配置流水线的时候用。
在这里插入图片描述

在这里插入图片描述

pipeline {agent anystages {stage('stop app'){steps {script {def remote = [:]//配置服务地址,用户名和密码remote.name = 'prd'remote.host = '114.116.1.1'remote.user = 'test'remote.password = 'test@123'remote.allowAnyHosts = true//连到服务器,停止服务器sshCommand remote: remote, command: "cd /data/test/gateway;sudo sh stop.sh"sshCommand remote: remote, command: "cd /data/test/infra;sudo sh stop.sh"sshCommand remote: remote, command: "cd /data/test/system;sudo sh stop.sh"sshCommand remote: remote, command: "cd /data/test/test;sudo sh stop.sh"sshCommand remote: remote, command: "cd /data/test/member;sudo sh stop.sh"}}}stage('pull code') {steps {//连到GIT地址,用上面配置的凭据IDcheckout scmGit(branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: '0a60a90e-6898-446c-bf49-d452dc1445a0', url: 'https://e.coding.net/g-cine6025/testshujuxiangmu/test.git']])}}stage('build project') {steps {sh 'mvn -DskipTests clean package'}}stage('start gateway'){steps {script {def remote = [:]remote.name = 'prd'remote.host = '114.116.1.1'remote.user = 'test'remote.password = 'test@123'remote.allowAnyHosts = truesshCommand remote: remote, command: "ls -lrt"//先从docker中的jar拷到本机,查看你的配置的生成的jar包在哪个路径sshCommand remote: remote, command: "sudo cp /var/jenkins_home/workspace/部署管理后应用/gateway/target/gateway.jar /data/test/gateway/gateway.jar"sshCommand remote: remote, command: "sudo cp /var/jenkins_home/workspace/部署管理后应用/module-infra/module-infra-biz/target/module-infra-biz.jar /data/test/infra/module-infra-biz.jar"sshCommand remote: remote, command: "sudo cp /var/jenkins_home/workspace/部署管理后应用/module-system/module-system-biz/target/module-system-biz.jar /data/test/system/module-system-biz.jar"sshCommand remote: remote, command: "sudo cp /var/jenkins_home/workspace/部署管理后应用/module-test/module-biz/target/module-biz.jar /data/test/test/module-biz.jar"sshCommand remote: remote, command: "sudo cp /var/jenkins_home/workspace/部署管理后应用/module-member/module-member-biz/target/module-member-biz.jar /data/test/member/module-member-biz.jar"//执行启动命令sshCommand remote: remote, command: "cd /data/test/gateway;sudo sh start.sh"sshCommand remote: remote, command: "cd /data/test/infra;sudo sh start.sh"sshCommand remote: remote, command: "cd /data/test/system;sudo sh start.sh"sshCommand remote: remote, command: "cd /data/test/test;sudo sh start.sh"sshCommand remote: remote, command: "cd /data/test/member;sudo sh start.sh"}}}}
}
http://www.lryc.cn/news/433134.html

相关文章:

  • SQL 编程基础
  • sql 中名字 不可以 包含 mysql中 具有 特定意义 的单词
  • 分布式部署①
  • 开源可视化大屏superset Docker环境部署
  • tomato靶场通关攻略
  • 【Spring Boot 3】【Web】处理跨域资源共享 CORS
  • HUAWEI华为MateBook B5-420 i5 集显(KLCZ-WXX9,KLCZ-WDH9)原装出厂Windows10系统文件下载
  • 算法练习题10:leetcode76最小覆盖子串-滑动窗口
  • Svn常用操作技巧详细说明
  • 六、MySQL高级—架构介绍(1)
  • TensorRT-For-YOLO-Series项目:实现yolov10模型的python-tensorrt推理(对比int8与fp16推理差异)
  • 码上君量化互助社群介绍
  • Qt使用小技巧之按钮动态变化
  • MySQL——事务与存储过程(三)存储过程的使用(1)调用存储过程
  • 基于VUE2-dataV和echarts实现的可视化大屏,百分比适配PC端
  • FastAPI模块化:为复杂应用程序提供清晰的结构
  • 【Hot100】LeetCode—215. 数组中的第K个最大元素
  • pycharm如何安装selenium
  • css三点闪烁(可用于加载样式、标题等)
  • 支持向量机 (Support Vector Machines, SVM)
  • 上海市计算机学会竞赛平台2024年8月月赛丙组调和级数
  • 【重学 MySQL】二十、运算符的优先级
  • 十种优化MySQL数据库的最佳建议
  • springboot组件使用-mybatis组件使用
  • Ribbon 源码分析【Ribbon 负载均衡】
  • Python | Leetcode Python题解之第385题迷你语法分析器
  • 进程间通信-进程池
  • 【PYTHON 基础系列-request 模块介绍】
  • springboot 实现策略模式通过id进入不同的服务类service
  • AUC真的什么情形下都适合吗