MultiJob Project (新版弃用)

最后更新于:2022-04-02 02:58:38

[TOC] ## 概述 1.在新建任务中选择 "MultiJob Project" ## 实例 ### go 打包脚本实例 linux
deploy.sh ``` #!/usr/bash # 如果go 版本比较高,则需要在脚本中添加 GOCACHE 与 GOPATH # 在 安装 jenkins 的服务器中执行 go env 获取真实 的GOCACHE 与 GOPATH #如 export GOCACHE="/root/.cache/go-build" export GOPATH="/root/go/" echo "start build linux transponder" build() { rm -rf ../build/linux/${1}_server/ mkdir -p ../build/linux/${1}_server/bin/ mkdir -p ../build/linux/${1}_server/config/ \cp ../config/${1}.yaml ../build/linux/${1}_server/config/ go build -ldflags "-w -s" -gcflags "all=-N -l" -o ../build/linux/${1}_server/bin/${1}_server ../cmd/${1}_server.go } # 内网包 build inner # 外网 build outer echo "finish build linux transponder" ```

window
main.go ``` @echo off echo "start build linux transponder" SET GOOS=windows call:build inner call:build outer echo "finish build linux transponder" goto :EOF :build del /F /S /Q ..\build\windows\%1_server\ md ..\build\windows\%1_server\bin\ md ..\build\windows\%1_server\config\ xcopy/ye ..\config\%1.yaml ..\build\windows\%1_server\config\ go build -ldflags "-w -s" -gcflags "all=-N -l" -o ..\build\windows\%1_server\bin\%1_server.exe ..\cmd\%1_server.go goto:EOF ```

';