-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
32 lines (32 loc) · 1.29 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
stages:
- release
- deploy
release_image:
stage: release
tags:
- docker
only:
- dev
- test
script:
- IMAGETAG=`date "+%Y%m%d"`-${CI_COMMIT_SHA:0:6}
- docker login -u $DOCKER_REGISTRY_USERNAME -p $DOCKER_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --pull -t $CI_REGISTRY/$CI_COMMIT_REF_NAME/$PROJECT_NAME .
- docker push $CI_REGISTRY/$CI_COMMIT_REF_NAME/$PROJECT_NAME
- docker tag $CI_REGISTRY/$CI_COMMIT_REF_NAME/$PROJECT_NAME $CI_REGISTRY/$CI_COMMIT_REF_NAME/$PROJECT_NAME:$IMAGETAG
- docker push $CI_REGISTRY/$CI_COMMIT_REF_NAME/$PROJECT_NAME:$IMAGETAG
deploy_to_dev_test:
stage: deploy
tags:
- docker
only:
- dev
- test
script:
- IMAGETAG=`date "+%Y%m%d"`-${CI_COMMIT_SHA:0:6}
- echo "IMAGETAG:"$IMAGETAG
- docker login -u $DOCKER_REGISTRY_USERNAME -p $DOCKER_REGISTRY_PASSWORD $CI_REGISTRY
# - docker build --pull -t $CI_REGISTRY/$CI_COMMIT_REF_NAME/$PROJECT_NAME:$IMAGETAG .
# - docker push $CI_REGISTRY/$CI_COMMIT_REF_NAME/$PROJECT_NAME:$IMAGETAG
- docker pull vpchub.sunmi.com/wifi/kubectl:$CI_COMMIT_REF_NAME
- docker run vpchub.sunmi.com/wifi/kubectl:$CI_COMMIT_REF_NAME kubectl set image deployment/$PROJECT_NAME $PROJECT_NAME=$TEST_HUB_NAME/$CI_COMMIT_REF_NAME/$PROJECT_NAME:$IMAGETAG --namespace=$CI_COMMIT_REF_NAME