我正在尝试为jenkins创建一个简单的流水线脚本来构建应用程序docker容器并在其中运行一个简单的测试。jenkins和docker的简单流水线脚本
node('swarm') {
// My project sources include both build.xml and a Dockerfile to run it in.
git credentialsId: 'jenkins-private-key', url: '[email protected]:myrepo/myapp.git'
try {
stage 'Build Docker'
def myEnv = docker.build 'repo_folder/myapp:latest'
stage 'Test'
myEnv.withRun {
sh 'gulp test'
}
stage 'Deploy'
echo 'Push to Repo'
stage 'Cleanup'
echo 'prune and cleanup'
sh 'npm prune'
sh 'rm node_modules -rf'
}
catch (err) {
currentBuild.result = "FAILURE"
throw err
}
}
在测试构建崩溃,我得到
咕嘟咕嘟没有找到
安装'gulp'? – StephenKing
'npm not found' ....我需要检查这些容器是否正确构建。谢谢 – Marrento