💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
**1. 在Jenkins创建流水线项目`tensquare-parent`** ![](https://img.kancloud.cn/45/82/4582f2dd4838d2e0da02aa20806f2f58_1246x508.jpg) **2. 指定`Jenkinsfile`脚本位置** ![](https://img.kancloud.cn/5c/1f/5c1fe67f46f94d6f9e0c97df7fcc076c_1394x547.jpg) ![](https://img.kancloud.cn/b2/91/b2910fe67c151a35f4e4e0d52f00a9c8_1256x527.jpg) **3. 添加项目参数`project_name`** ![](https://img.kancloud.cn/b4/75/b4750f69e646387a93110a01a5aa8485_1417x501.jpg) **4. 添加分支参数** ![](https://img.kancloud.cn/32/1a/321a044b5f7ba92ddc81ccc65eab82af_1310x388.jpg) **5. 生成Harbor凭证脚本代码** ![](https://img.kancloud.cn/41/89/4189a0214e509f454e907807c7ff0a79_1720x498.jpg) ![](https://img.kancloud.cn/b4/d1/b4d1ed704a25ff2d0f897ce1e5aef243_1503x736.jpg) ```groovy withCredentials([usernamePassword(credentialsId: '0d458918-e2ea-4b51-8250-91c3731be288', passwordVariable: 'password', usernameVariable: 'username')]) { // some block } ``` **6. 在Jenkins上安装插件 Publish Over SSH** 该插件,可以实现远程发送Shell命令。 **7. 配置远程部署服务器** (1)拷贝 jenkins-server 机器上的公钥到远程部署服务器 production-server。 ```shell --在jenkins机器执行下面命令,将公钥复制到 192.168.1.30(production-server) ssh-copy-id 192.168.1.30 ``` (2)系统管理 -> 系统配置 -> Publish over SSH。 ![](https://img.kancloud.cn/44/d9/44d9c576133ae05a78b114fd6d5aeb9a_1466x387.jpg) ![](https://img.kancloud.cn/9c/24/9c244f1e638630e88cdb3a16b245d16e_1467x485.jpg) **8. 生成远程调用部署服务器的模板代码** ![](https://img.kancloud.cn/57/55/5755fb8e78d13cc80bd42cbf5d52aa15_1574x625.jpg) ![](https://img.kancloud.cn/65/38/6538fad31223c4a33d9e0550ab98c223_1469x641.jpg) ![](https://img.kancloud.cn/2c/1d/2c1d451882299c98f790c42e4d838570_1452x252.jpg) ```groovy sshPublisher(publishers: [sshPublisherDesc(configName: 'production-server', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) ``` **9. 添加一个`port`参数** ![](https://img.kancloud.cn/8b/16/8b168c6cd55eb8e1af670810a5c78ec5_1329x377.jpg)