|
@@ -6,7 +6,7 @@ pipeline {
|
|
agent none
|
|
agent none
|
|
stages {
|
|
stages {
|
|
// 生产
|
|
// 生产
|
|
- stage('prod') {
|
|
|
|
|
|
+ stage('prod build') {
|
|
// 自动构建项目根目录下的 Dockerfile 文件,并使用其为运行容器
|
|
// 自动构建项目根目录下的 Dockerfile 文件,并使用其为运行容器
|
|
agent { dockerfile true }
|
|
agent { dockerfile true }
|
|
// 当分支为master的时候执行
|
|
// 当分支为master的时候执行
|
|
@@ -26,7 +26,7 @@ pipeline {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 测试环境
|
|
// 测试环境
|
|
- stage('test') {
|
|
|
|
|
|
+ stage('test build') {
|
|
// 使用 docker 镜像 php:7.4-cli 为运行容器
|
|
// 使用 docker 镜像 php:7.4-cli 为运行容器
|
|
agent { docker 'php:7.4-cli' }
|
|
agent { docker 'php:7.4-cli' }
|
|
when {
|
|
when {
|
|
@@ -37,9 +37,18 @@ pipeline {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 生产环境
|
|
// 生产环境
|
|
- stage('dev') {
|
|
|
|
|
|
+ stage('dev build') {
|
|
// 在任何可用的代理上执行流水线或阶段,没有多节点的情况下其实就是直接执行shell啦。。
|
|
// 在任何可用的代理上执行流水线或阶段,没有多节点的情况下其实就是直接执行shell啦。。
|
|
agent any
|
|
agent any
|
|
|
|
+ /*
|
|
|
|
+ agent {
|
|
|
|
+ docker {
|
|
|
|
+ image 'php:8.2-cli'
|
|
|
|
+ lable: 'develop-server' // 在lable为xxx的节点对应docker容器运行
|
|
|
|
+ args: ' --verbose' // 额外的docker参数
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ */
|
|
when {
|
|
when {
|
|
branch 'dev'
|
|
branch 'dev'
|
|
}
|
|
}
|
|
@@ -50,6 +59,9 @@ pipeline {
|
|
// 没有when也就是任意时候都会执行
|
|
// 没有when也就是任意时候都会执行
|
|
stage('after build') {
|
|
stage('after build') {
|
|
agent any
|
|
agent any
|
|
|
|
+ /*
|
|
|
|
+ agent { lable: 'maybe-server' } // 在lable为xxx的节点上运行
|
|
|
|
+ */
|
|
steps {
|
|
steps {
|
|
echo 'Always excecute after other stages.'
|
|
echo 'Always excecute after other stages.'
|
|
}
|
|
}
|