繁体   English   中英

如果我的项目不在根目录中,如何从 Jenkins 执行 npm install 和 npm

[英]How do I execute npm install and npm from Jenkins if my project is in not in the root directory

假设我在名为 project 的私有存储库目录中。 所以我想要么将此文件夹中的内容复制到 Jenkins 工作区,要么复制所有存储库但从 Workspace/project/ 运行 npm install(npm run)。

如果我的项目不在根目录中,如何从 Jenkins 执行 npm install 和 npm --prefix path 不起作用

这是一个简单的管道代码,供您在其上构建。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM