jenkins CI/CD(持续集成,多分支,多测试环境)
1.构建项目时可以选择分支2.构建中途可以设置docker容器对外暴露的端口号Jenkinsfile:pipeline {agent anyenvironment {CI = 'true'}stages {stage('install') {input {message "Please set the port number?".
·
1.构建项目时可以选择分支

2.构建中途可以设置docker容器对外暴露的端口号

Jenkinsfile:
pipeline {
agent any
environment {
CI = 'true'
}
stages {
stage('install') {
input {
message "Please set the port number?"
ok "Ok"
parameters {
string(name: 'PORT', defaultValue: '3002', description: ' Set the expose port number of docker container?')
}
}
agent {
docker {
image 'node:12'
args "-p ${PORT}:3002"
}
}
steps {
echo 'hello,world!'
echo "PORT: ${PORT}"
sh 'yarn -v'
sh 'yarn'
sh 'set -x'
sh 'yarn build_jenkins'
sh 'set +x'
sh 'yarn server'
}
}
}
}
3.一个分支对应一个docker容器,单独的测试环境,互不影响



魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)