# web_back **Repository Path**: wangchirl/web_back ## Basic Information - **Project Name**: web_back - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 4 - **Created**: 2021-06-12 - **Last Updated**: 2022-08-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 一、yaml文件夹 > 主要是部署 jenkins 中使用到的 .sh 脚本文件和 yaml 文件 ### 二、其他材料可参考 [https://github.com/wangchirl](https://github.com/wangchirl) ### 三、三个分支 - master 分支 > 针对首次使用 流水线 Jenkinsfile 部署的情况 - release 分支 > 针对多项目流水线 Jenkinsfile 部署的情况 - latest 分支 > K8S 动态扩缩容项目构建 >- 创建参数 branch 、project_name >- 配置凭证 github/gitee/gitlab 、harbor、k8s >>- github & harbor:使用用户名密码的方式 >>- k8s :使用 Kubernetes configure > cat /root/.kube/config >- 每个微服务创建 deploy.yml 配置文件 >- 修改微服务中 application.yml 配置 ```sh def git_address = "https://gitee.com/wangchirl/web_back.git" def git_auth = "48054e94-2b4e-4ebd-a774-c069ca29f967" //构建版本的名称 def tag = "latest" //Harbor私服地址 def harbor_url = "10.0.0.201:88" //Harbor的项目名称 def harbor_project_name = "oracle" //Harbor的凭证 def harbor_auth = "00494390-f74f-4ce7-b998-534b5c400d3f" // k8s-auth def k8s_auth = "91f0ed5a-e1bb-4ddc-80ab-143878bb2d00" // secret_name def secret_name = "registry-auth-secret" podTemplate(label: 'jenkins-slave', cloud: 'kubernetes', containers: [ containerTemplate( name: 'jnlp', image: "10.0.0.201:88/library/jenkins-slave-maven:latest" ), containerTemplate( name: 'docker', image: "docker:stable", ttyEnabled: true, command: 'cat' ), ], volumes: [ hostPathVolume(mountPath: '/var/run/docker.sock', hostPath:'/var/run/docker.sock'), nfsVolume(mountPath: '/usr/local/apache-maven/repo', serverAddress:'10.0.0.226' , serverPath: '/opt/nfs/maven'), ], ) { node("jenkins-slave"){ // 第一步 stage('拉取代码'){ checkout([$class: 'GitSCM', branches: [[name: '${branch}']], userRemoteConfigs: [[credentialsId: "${git_auth}", url: "${git_address}"]]]) } // 第二步 stage('代码编译'){ //编译并安装公共工程 sh "mvn -f tensquare_common clean install" } // 第三步 stage('构建镜像,部署项目'){ //把选择的项目信息转为数组 def selectedProjects = "${project_name}".split(',') for(int i=0;i