嗨,我正在尝试使用jenkins管道在ec2实例中运行python应用。我使用publish over ssh
插件来在ec2实例中运行命令,但出现错误。我在问题中发布带有错误图像的代码。任何帮助将不胜感激
pipeline {
agent any
tools {nodejs "node"}
stages {
stage('Git') {
steps {
git 'https://github.com/***/Jenkins-NodeJs'
}
}
stage('Build') {
steps {
sh 'pwd'
sh 'npm install'
sh 'npm install express'
}
}
stage('Deployment') {
steps {
script {
sshPublisher(publishers: [
sshPublisherDesc(
configName: "${env.ec2-user}",
transfers: [
sshTransfer(
sourceFiles: "/var/lib/jenkins/workspace/Nodejs-pipelines/app.js",
execCommand: "cd nodejs, cp -f app.js "
)
],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: false
)]
)
}
}
}
}
}