egg_attach_template/.gitlab-ci.yml

39 lines
965 B
YAML

variables:
REGISTRY: micr.cloud.mioffice.cn
IMAGE_NAME: micr.cloud.mioffice.cn/egg/replace_me
MATRIX_PROJECT: 462609
MATRIX_SPACE: egg-gitlab-cr-prev
MATRIX_AK: CAKBCYGR0BI2BGMVUF8
stages:
- build
- deploy
default:
tags:
- fe-bj
build:
stage: build
only:
- master
image: docker:latest
services:
- docker:dind
script:
- cp $ENV .env
- docker login -u $MATRIX_AK -p $MATRIX_SK $REGISTRY
- docker build -t $IMAGE_NAME:$CI_COMMIT_SHA -f ./docker/deploy/Dockerfile .
- docker push $IMAGE_NAME:$CI_COMMIT_SHA
- docker logout $REGISTRY
- docker rmi $IMAGE_NAME:$CI_COMMIT_SHA
deploy:
stage: deploy
only:
- master
image: cr.d.xiaomi.net/bigdata-fe/matrix-cli
script:
- matrix-cli config set --access-key $MATRIX_AK --secret-key $MATRIX_SK
- matrix-cli deploy --project $MATRIX_PROJECT --deploy-space $MATRIX_SPACE --reason "$CI_COMMIT_MESSAGE" --deploy-percentage 1 --tag $CI_COMMIT_SHA