Jenkins Ssh代理步骤使用了错误的工作目录
突然,在没有任何管道更改的情况下,ssh代理插件使用了错误的workingdir。我在部署步骤中使用它将文件rsync到测试服务器环境中Jenkins Ssh代理步骤使用了错误的工作目录,jenkins,jenkins-pipeline,Jenkins,Jenkins Pipeline,突然,在没有任何管道更改的情况下,ssh代理插件使用了错误的workingdir。我在部署步骤中使用它将文件rsync到测试服务器环境中 [project@2] Running shell script <-- build step [project@2] Running shell script <-- test step [project] Running shell script <-- deployment step 看起来你忘了为你的最后一个阶段确定目标。您可以在一
[project@2] Running shell script <-- build step
[project@2] Running shell script <-- test step
[project] Running shell script <-- deployment step
看起来你忘了为你的最后一个阶段确定目标。您可以在一个
代理上运行管道。在这种情况下,请在开始时确定“代理”。谢谢!我加上了“any探员”现在它可以工作了。。我认为第2行的“任何代理”是每个阶段的默认设置。这个Jenkins文件以前在没有代理声明的情况下工作过。不客气。也许詹金斯不小心碰到了同一个探员。仅供参考:不要忘记节点
pipeline {
agent any
stages {
stage('Build') {
agent {
docker {
image 'composer:latest'
}
}
steps {
sh 'composer install --ignore-platform-reqs'
}
}
stage('Test') {
agent {
docker {
image 'php:7.1.13-cli'
}
}
steps {
sh './vendor/bin/phpunit'
}
}
stage('Deploy') {
steps {
sshagent (credentials: ['PROJECT_KEY']) {
sh 'rsync \
-a \
--delete \
--exclude="*local.php" \
--exclude=".*" \
--include="config/***" \
--include="module/***" \
--include="vendor/***" \
--include="shell/***" \
--include="bin/***" \
--include="init_autoloader.php" \
--exclude="*" \
-e "ssh -p 2222" \
. username@*****.com:/data/sites/test.*****.com/'
}
}
}
}
}