From 8787afabf1fd907c1db458d0d21d0ab3ae4d9dba Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 19 Dec 2024 12:18:52 +0800 Subject: [PATCH] =?UTF-8?q?ci(chuanqi):=20=E6=B7=BB=E5=8A=A0=E4=BC=A0?= =?UTF-8?q?=E5=A5=87=E7=BD=91=E9=A1=B5=E9=85=8D=E7=BD=AE=E7=9A=84=20Jenkin?= =?UTF-8?q?s=20=E6=9E=84=E5=BB=BA=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 Jenkins 构建脚本,实现传奇网页配置项目的自动化构建和部署 - 包含代码拉取、打包和部署三个阶段 - 在成功部署后,通过 Telegram 发送通知 --- chuanqi_web_config_jenkins | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 chuanqi_web_config_jenkins diff --git a/chuanqi_web_config_jenkins b/chuanqi_web_config_jenkins new file mode 100644 index 0000000..896151b --- /dev/null +++ b/chuanqi_web_config_jenkins @@ -0,0 +1,47 @@ +pipeline { + agent any + stages { + stage('拉取代码') { + steps { + checkout([ + $class: 'GitSCM', + branches: [[name: '*/main']], + doGenerateSubmoduleConfigurations: false, + extensions: [], + submoduleCfg: [], + userRemoteConfigs: [[url: 'http://192.168.25.110:8999/kubbo/chuanqi-client-config.git',credentialsId:'d54e1035-acca-424e-80d0-9f7e29cab9c3']] + ]) + } + } + stage('打包') { + steps { + echo "正在打包的工程==>: ${params.pid}" + sh "npm i" + sh "npm run build" + } + } + stage('部署') { + steps { + echo 'Deploying...' + sh "cp config.xml /home/cq/web/resource_Publish/cfg/" + } + } + } + post{ + success { + echo 'Deployment finished successfully.' + sh """ + curl 'https://api.telegram.org/bot7816434196:AAFtmbUYpUIwcb_SvBnJY0guPIOLCxp2a5s/sendMessage' \\ + -x http://192.168.25.110:20171\\ + -H 'Content-Type: application/json' \\ + -d '{ + "chat_id": "6779541681", + "text":"传奇web构建完成!", + }' + """ + } + failure { + echo 'Deployment failed.' + } + } +}