-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.gitlab-ci.yml
51 lines (42 loc) · 1.49 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
image: registry.cn-shanghai.aliyuncs.com/choerodon-tools/cibase:0.9.1
stages:
- build
- release
variables:
GIT_SUBMODULE_STRATEGY: recursive
build:
stage: build
script:
- node_module demo
- node_build build
- mv node_modules/choerodon-front-boot/structure ./structure
- mv ../Dockerfile .
- docker_build
release:
stage: release
script:
- chart_build
.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=front"`
if [ "$http_status_code" != "200" ]; then
cat .auto_devops.sh
exit 1
fi
source .auto_devops.sh
function node_module(){
cd ${1} && npm install --registry https://nexus.choerodon.com.cn/repository/choerodon-npm/ --sass-binary-site=http://npm.taobao.org/mirrors/node-sass && cd ..
python ./${1}/node_modules/choerodon-front-boot/structure/menu/__init__.py -o yml -m ${1}
cd ${1}
}
function node_build(){
chmod -R 777 node_modules
npm run ${1:-"build"}
find dist -name '*.js' | xargs sed -i "s/localhost:version/$CI_COMMIT_TAG/g"
}
function docker_build(){
docker login -u ${DOCKER_USER} -p ${DOCKER_PWD} ${DOCKER_REGISTRY}
docker build -t ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG} ${1:-"."}
docker push ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}
}
before_script:
- *auto_devops