fix: fix gitlab-ci.yml

This commit is contained in:
shizhendong
2021-06-24 17:04:07 +08:00
parent e8c8aa1646
commit ae10488cc5

View File

@@ -1,6 +1,7 @@
stages:
- gen_git-log
- build_project
- build_image
# - build_image
cache:
key:
@@ -12,6 +13,17 @@ cache:
before_script:
- export UI_TAG=$(date +%Y%m%d%H%M%S)
generate_git-log:
stage: gen_git-log
script:
- if (( `grep git-log.html ./public/index.html | wc -l` == 0 )); then sed -i '/<body>/ a <a style="position:fixed;bottom:20px;left:40px;z-index:999;color:white;" target="_blank" href="./git-log.html">更新记录</a>' ./public/index.html; echo "添加更新记录链接"; fi;
- echo "最近的100个提交记录"
- echo "<pre>" > ./public/git-log.html
- git log -100 --pretty=format:"%ad : %s" >> ./public/git-log.html
- echo "</pre>" >> ./public/git-log.html
- echo "处理 git-log.html 结束"
build_project:
stage: build_project
script:
@@ -27,18 +39,18 @@ build_project:
tags:
- GN-XXG-Server
build_image:
stage: build_image
script:
- echo "docker build"
- sudo docker build -t dev_cn-ui:$UI_TAG .
- echo "docker tag"
- sudo docker tag dev_cn-ui:$UI_TAG 192.168.40.153:9080/cyber-narrator/dev_cn-ui:$UI_TAG
- echo "docker push"
- sudo docker push 192.168.40.153:9080/cyber-narrator/dev_cn-ui:$UI_TAG
when: on_success
only:
- dev-cicd
tags:
- GN-XXG-Server
#build_image:
#stage: build_image
#script:
# - echo "docker build"
# - sudo docker build -t dev_cn-ui:$UI_TAG .
# - echo "docker tag"
#- sudo docker tag dev_cn-ui:$UI_TAG 192.168.40.153:9080/cyber-narrator/dev_cn-ui:$UI_TAG
#- echo "docker push"
# - sudo docker push 192.168.40.153:9080/cyber-narrator/dev_cn-ui:$UI_TAG
#when: on_success
#only:
# - dev-cicd
# tags:
# - GN-XXG-Server