简体   繁体   English

在nodejs中构建jenkins管道

[英]building jenkins pipeline in nodejs

I need to implement this:我需要实现这个:

pipeline {
    agent none
    stages {
        stage('Build') {
            agent {
                docker {
                    image 'python:2-alpine'
                }
            }
            steps {
                sh 'python -m py_compile sources/add2vals.py sources/calc.py'
            }
        }
        stage('Test') {
            agent {
                docker {
                    image 'qnib/pytest'
                }
            }
            steps {
                sh 'py.test --verbose --junit-xml test-reports/results.xml sources/test_calc.py'
            }
            post {
                always {
                    junit 'test-reports/results.xml'
                }
            }
        }
    }
}

on a nodejs express project and run unit tests with mocha and chai, this is my code:在 nodejs express 项目上并使用 mocha 和 chai 运行单元测试,这是我的代码:

pipeline {
    agent { docker { image 'node:6.3' } }
    stages {
        stage('build') {
            steps {
                sh 'npm --version'
            }
        }
    }
}

can anyone tell me how I should do that?谁能告诉我该怎么做? the example is with python so I have no idea what I need to do.这个例子是 python 所以我不知道我需要做什么。

I would take a look at the resources on the Jenkins blog.我会看一下 Jenkins 博客上的资源。 What you are looking at is the Jenkinsfile which sits in the root of your project directory.您正在查看的是位于项目目录根目录中的 Jenkinsfile。

https://jenkins.io/doc/tutorials/build-a-node-js-and-react-app-with-npm/ https://jenkins.io/doc/tutorials/build-a-node-js-and-react-app-with-npm/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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