加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.gitlab-ci.yml 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
handadmin 提交于 2020-09-22 22:27 . [AUTO] init project
image: registry.cn-hangzhou.aliyuncs.com/choerodon-tools/cibase:0.7.0
stages:
- mvn-package
- docker-build
maven-test-docker:
stage: mvn-package
script:
- update_pom_version
- mvn clean package -U -DskipTests=true
- mkdir -p /cache/${CI_PROJECT_NAME}-${CI_PROJECT_ID}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
- cp target/app.jar /cache/${CI_PROJECT_NAME}-${CI_PROJECT_ID}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}/app.jar
only:
- tags
- /^.*develop$/
- /^.*master$/
- /^.*-test$/
- /^.*-beta$/
- /^.*-release$/
- /^.*-hotfix$/
docker-build:
stage: docker-build
script:
- docker_build
- chart_build
only:
- tags
- /^.*-beta$/
- /^.*-release$/
.auto_devops: &auto_devops |
http_status_code=`curl -o .auto_devops.sh -s -m 10 --connect-timeout 10 -w %{http_code} "${CHOERODON_URL}/devops/ci?token=${Token}&type=microservice"`
if [ "$http_status_code" != "200" ]; then
cat .auto_devops.sh
exit 1
fi
source .auto_devops.sh
function docker_build(){
cp /cache/${CI_PROJECT_NAME}-${CI_PROJECT_ID}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}/app.jar ${1:-"src/main/docker"}/app.jar || true
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} ${DOCKER_REGISTRY}
docker build --pull -t ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG} ${1:-"src/main/docker"}
docker push ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}
rm -rf /cache/${CI_PROJECT_NAME}-${CI_PROJECT_ID}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
}
before_script:
- *auto_devops
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化