jenkins前端常用插件:
Git Parameter 、Maven Integration 、Proxmox(snapshot)、Pipeline: Multibranch(多分支流水线)、Pipeline: Stage Step、pipeline
Git plugin、NodeJS Plugin、Publish Over SSH、SSH server、GitLab Plugin
1、SSH Servers的配置,如何没有,请去插件管理安装ssh

2、新建一个任务
设置参数化构建






根据变量判断环境
bash
node -v
rm -rf node_modules
npm install
if test $env = "test"; then
echo "test"
npm run build:test
else
echo "prod"
npm run build
fi