我需要实现这一点:
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的,所以我不知道该怎么做。
我将看看Jenkins博客上的资源。您正在查看的是位于项目目录根目录中的Jenkinsfile。
https://jenkins.io/doc/tutorials/build-a-node-js-and-react-app-with-npm/