Open fangmd opened 2 years ago
NodeJS
/configureTools/
下增加 nodejspipeline {
agent { label 'mac16' }
tools {nodejs "pnpm-node16"}
//....
SSH Agent
创建个临时view,然后在临时view中创建 Credentials
输入 ssh 用户名/密码,描述
在 /credentials/
下找到 Credentials id:
sshagent (credentials: ["3393a9bf-ade6-4169-b9e6-0bc8f3bf1f13"]) {
sh "scp -o StrictHostKeyChecking=no travel-admin.tar.gz root@39.107.157.18:/usr/share/nginx/html"
sh "ssh -o StrictHostKeyChecking=no root@39.107.157.18 \"tar -xvf /usr/share/nginx/html/travel-admin.tar.gz -C /usr/share/nginx/html/ && rm -rf /usr/share/nginx/html/old-travel-admin && mv /usr/share/nginx/html/travel-admin /usr/share/nginx/html/old-travel-admin && mv /usr/share/nginx/html/build /usr/share/nginx/html/travel-admin && rm -rf /usr/share/nginx/html/dist\""
}
如果出现这个问题,可以试试使用 账号+密钥 的方式创建 credentials
stage('deploy') {
steps{
script{
echo "start deploy"
dir("${env.WORKSPACE}/xxxxxx") {
archiveArtifacts artifacts: 'xxxx.tar.gz', fingerprint: true
//....
}
}
}
}
构建参数添加 git 分支
Active Choices
BRANCH_NAME