Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
.gitlab-ci.yml 1.56 KB
Copy Edit Raw Blame History
handadmin authored 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 助手
尝试更多
代码解读
代码找茬
代码优化