def call(body) { def config = [:] body.resolveStrategy = Closure.DELEGATE_FIRST body.delegate = config body() echo 'Checking out code from "' + config.repoUrl + '" with credentialsId "' + / config.credentialsId + '" ...' checkout([$class: 'GitSCM', branches: [[name: config.branches]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: config.credentialsId, url: config.repoUrl]]]) }
def call(body) { def config = [:] body.resolveStrategy = Closure.DELEGATE_FIRST body.delegate = config body() pipeline { agent { label 'build-server' } stages { stage('Initialization') { steps { script { echo "项目初始化" } } } stage('CI') { steps{ script{ gitCheckout{ repoUrl = config.repoUrl credentialsId = config.credentialsId branches = config.branches commit = config.commit } } } } stage('Service') { echo "启动dockder服务" } } } }
@Library("lind-library") _ servicePipeline ( { repoUrl = "git@github.com:bfyxzls/LindDotNetCore.git" credentialsId = "012f0d4e-47e2-48ce-8b9e-cd399e9b3d61" branches = "dev" })
事实上,上面的构建只是一个基础版本,当你的构建有多种语言组成时,你需要为他们分别写一个入口,如dotnet,nodejs,java,php,==它们有自己的入口==,然后再servicePipeline里去分别处理,前开发人员输入语言类型,然后统一进行处理。