1 Star 0 Fork 272

caixiaomao/crawlab

forked from tikazyq/crawlab 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Jenkinsfile 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
Marvin Zhang 提交于 2019-08-18 13:09 . updated Jenkinsfile
pipeline {
agent {
node {
label 'crawlab'
}
}
stages {
stage('Setup') {
steps {
echo "Running Setup..."
script {
if (env.GIT_BRANCH == 'develop') {
env.TAG = 'develop'
env.DOCKERFILE = 'Dockerfile.local'
} else if (env.GIT_BRANCH == 'master') {
env.TAG = 'master'
env.DOCKERFILE = 'Dockerfile.local'
} else if (env.GIT_BRANCH == 'frontend') {
env.TAG = 'frontend-alpine'
env.DOCKERFILE = 'docker/Dockerfile.frontend.alpine'
} else if (env.GIT_BRANCH == 'backend-master') {
env.TAG = 'master-alpine'
env.DOCKERFILE = 'docker/Dockerfile.master.alpine'
} else if (env.GIT_BRANCH == 'backend-worker') {
env.TAG = 'worker-alpine'
env.DOCKERFILE = 'docker/Dockerfile.worker.alpine'
}
}
}
}
stage('Build') {
steps {
echo "Building..."
sh """
docker build -t tikazyq/crawlab:${ENV:TAG} -f ${ENV:DOCKERFILE} .
"""
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
sh """
if [[ ${ENV:GIT_BRANCH} = master ]] || [[ ${ENV:GIT_BRANCH} = develop ]]; then
# 重启docker compose
cd ./jenkins/${ENV:GIT_BRANCH}
docker-compose stop | true
docker-compose up -d
else
# 发布到Dockerhub
docker push tikazyq/crawlab:${ENV:TAG}
fi
"""
}
}
stage('Cleanup') {
steps {
echo 'Cleanup...'
sh """
docker image prune -f
"""
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/hexiaomao2013/crawlab.git
git@gitee.com:hexiaomao2013/crawlab.git
hexiaomao2013
crawlab
crawlab
master

搜索帮助