在nodejs中构建jenkins管道

问题描述 投票:0回答:1

我需要实现这一点:

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'
                }
            }
        }
    }
}

在nodejs express项目上,并使用mocha和chai运行单元测试,这是我的代码:

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

谁能告诉我该怎么做?该示例是使用python的,所以我不知道该怎么做。

node.js express jenkins mocha chai
1个回答
0
投票

我将看看Jenkins博客上的资源。您正在查看的是位于项目目录根目录中的Jenkinsfile。

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

© www.soinside.com 2019 - 2024. All rights reserved.