我有 Jenkinsfile,我试图将 BuildApp 隐藏起来,然后将其解散到其他 docker 容器中以运行 npm 测试。但似乎缺少 node_modules,所以 npm 测试失败。
steps {
dir("/var/jenkins_home") {
unstash "app"
}
echo "Building app (CLOUD_ENV = ${env.CLOUD_ENV})"
sh 'yarn install'
stash name: "BuildApp", includes: "*"
sh "ls -la ${pwd()}"
}
Run Code Online (Sandbox Code Playgroud)
那就是我试图藏匿的地方,我用“ls -la ${pwd()}”进行了调试,我看到 node_modules 就在那里,但是当它们解除藏匿时
steps {
dir("/var/jenkins_home") {
unstash "BuildApp"
}
echo "Testing app (CLOUD_ENV = ${env.CLOUD_ENV})"
// unstash 'builtApp'
sh "ls -la ${pwd()}"
sh 'npm test > test.out'
archiveArtifacts artifacts: 'test.out', fingerprint: true
stash name: "testApp", includes: "*"
}
Run Code Online (Sandbox Code Playgroud)
我做了“ls -la …
是否可以使用 docker-compose 带 4-5 个容器然后运行 ansible 角色?(Ansible 可以安装到一个容器上或从我的本地 PC 运行到一个容器)所以基本上那些 4-5 个容器将成为我的目标主机。