代码拉取完成,页面将自动刷新
同步操作将从 秋凤颜梦/spring-cloud-wang 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
def tag = "latest"
def harbor_url = "xxx:18080"
def harbor_project = "test"
def harbor_auth = "xxx"
node {
def selectProjectNames = "${name}".split(",")
def serverNames = "${server}".split(",")
stage('拉取代码'){
git branch: 'test', credentialsId: 'xxx', url: 'http://xxx33333/backend/xxx.git'
}
stage('安装 公共类'){
sh "mvn -f recharge-common clean install"
sh "mvn -f recharge-api clean install"
}
stage('编译 打包 上传镜像'){
for(int i=0;i<selectProjectNames.length;i++){
def projectInfo = selectProjectNames[i];
def currentProjectName = "${projectInfo}".split("@")[0]
def currentProjectPort = "${projectInfo}".split("@")[1]
sh "mvn -f ${currentProjectName} clean package dockerfile:build"
def imageName = "${currentProjectName}:${tag}"
sh "docker tag ${imageName} ${harbor_url}/${harbor_project}/${imageName}"
withCredentials([usernamePassword(credentialsId: "${harbor_auth}", passwordVariable: 'password', usernameVariable: 'username')]) {
sh "docker login -u ${username} -p ${password} ${harbor_url}"
sh "docker push ${harbor_url}/${harbor_project}/${imageName}"
sh "echo 镜像上传成功"
}
for(int j=0;j<serverNames.length;j++){
def serverName = serverNames[j];
sshPublisher(publishers: [sshPublisherDesc(configName: "${serverName}", transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: "/opt/jenkins_shell/deploy.sh $harbor_url $harbor_project $currentProjectName $tag $currentProjectPort", execTimeout: 1200000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。