[英]How do I execute npm install and npm from Jenkins if my project is in not in the root directory
Lets say I have in private repository directory called project.假设我在名为 project 的私有存储库目录中。 So I want either copy what inside this folder to Jenkins workspace or copy all repository but run npm install(npm run) from Workspace/project/.
所以我想要么将此文件夹中的内容复制到 Jenkins 工作区,要么复制所有存储库但从 Workspace/project/ 运行 npm install(npm run)。
How do I execute npm install and npm from Jenkins if my project is in not in the root directory --prefix path doesn't work如果我的项目不在根目录中,如何从 Jenkins 执行 npm install 和 npm --prefix path 不起作用
Here is a simple pipeline code for you to build on top of.这是一个简单的管道代码,供您在其上构建。
pipeline {
agent any
stages {
stage('Build') {
steps {
// Clone your repo
git 'https://github.com/jglick/simple-maven-project-with-tests.git'
}
}
stage('NPM Run') {
steps {
// dir will execute you commands within this directory. Another option is to cd in to the project directory and execute your command.
dir('project') {
sh "npm run wdio"
}
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.