zoukankan      html  css  js  c++  java
  • Pipeline流水线 自动脚本

    Pipeline流水线脚本样板:

    pipeline {
        agent any
        stages {
            stage('pull code') {
                steps {
    		echo 'pull code'
    		}
    	}
    	stage('build project') {
    	    steps {
    		echo 'build project'
    		}
    	}
    	stage('publish project') {
    	    steps {
    		echo 'public project'
    		}
     	    }
    	}
        }
    

      

    步骤:
    新建Item-->Pipline
    Pipeline-->Pipline script-->(try sample Pipeline)Hello World-->(流水线语法)获取脚本:

    1、pull code/steps部分
    流水线语法:
    1)checkout:Check out from version control
    2)SCM:Git
    Repository URL:http://192.168.1.100:82(Gitlab服务器地址)
    Credentials: root-auth-ssh
    3)生成流水线脚本
    4)复制脚本 粘贴到 pipeline脚本中 steps/pull code部分

    2、build project/steps部分
    流水线语法:
    1)sh:Shell Script
    2)Shell Script: mvn clean package
    3)生成流水线脚本
    4)复制脚本 粘贴到 pipeline脚本中 steps/build project部分

    3、publish project/steps部分
    流水线语法:
    1)deploy:Deploy war/ear to a container
    2)WAR/EAR file——target/*.war
    3)Tomcat 8.x Remote/Credentials:xxx Tomcat URL
    4)生成流水线脚本
    5)复制脚本 粘贴到 pipeline脚本中 steps/publish project部分

    pipeline {
        agent any
    
        stages {
            stage('pull code') {
                steps {
                  checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: '37f6cba9-628e-4a81-a5bd-b415651d3863', url: 'git@192.168.80.130:hrdev_group01/web_demo.git']]])
                }
            }
            stage('build project'){
                steps {
                  sh 'mvn clean package'
                }
            }
            stage('publish project'){
                steps {
                  deploy adapters: [tomcat8(credentialsId: 'e38c1f60-e81d-4595-a630-bf86404820c5', path: '', url: 'http://192.168.80.161:8080')], contextPath: null, war: 'target/*.war'
                }
            }
            
            }
        }
    

      

  • 相关阅读:
    JQuery实现页面跳转
    CSS中让背景图片居中且不平铺
    C#后台将string="23.00"转换成int类型
    BootStrap的一些基本语法
    CSS实现文字阴影的效果
    BootStrap自定义轮播图播放速度
    BootStrap 轮播插件(carousel)支持左右手势滑动的方法(三种)
    C#常用快捷键
    jQuery hover() 方法
    鼠标移动有尾巴
  • 原文地址:https://www.cnblogs.com/walkersss/p/15003207.html
Copyright © 2011-2022 走看看