-
Notifications
You must be signed in to change notification settings - Fork 52
/
.gitlab-ci.yml
71 lines (63 loc) · 2.11 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
image: registry.cn-shanghai.aliyuncs.com/c7n/cibase:0.11.4
stages:
- node-build
- chart-build
variables:
GIT_SUBMODULE_STRATEGY: recursive
node-build:
stage: node-build
script:
- export CI_COMMIT_TAG="${CI_COMMIT_TAG}-${CI_PIPELINE_ID}"
- echo "${NPM_REPO}"
- npm config set "//${NPM_REPO}:_authToken" "${NPM_TOKEN}"
# - npm config set "//${NPM_REGISTRY}:_authToken" "${NPM_TOKEN}"
- npm config set always-auth true
- npm cache clean --force
- npm install --registry "https://${NPM_REPO}" --sass-binary-site=http://npm.taobao.org/mirrors/node-sass
- chmod -R 755 node_modules
- npm run dist
- cp -r src/main/resources/lib $CI_PROJECT_DIR/docker/lib
- kaniko -c $CI_PROJECT_DIR/docker -f $CI_PROJECT_DIR/docker/Dockerfile -d ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}
cache:
key: ${CI_COMMIT_REF_NAME}
paths:
- node_modules/node-sass
policy: pull-push
except:
- tags
chart-build:
stage: chart-build
script:
- export CI_COMMIT_TAG="${CI_COMMIT_TAG}-${CI_PIPELINE_ID}"
- chart_build
except:
- tags
node-build-tag:
stage: node-build
script:
- npm config set "//${NPM_REPO}:_authToken" "${NPM_TOKEN}"
# - npm config set "//${NPM_REGISTRY}:_authToken" "${NPM_TOKEN}"
- npm config set always-auth true
- npm install --registry "https://${NPM_REPO}" --sass-binary-site=http://npm.taobao.org/mirrors/node-sass
- chmod -R 755 node_modules
- npm run dist
- cp -r src/main/resources/lib $CI_PROJECT_DIR/docker/lib
- kaniko -c $CI_PROJECT_DIR/docker -f $CI_PROJECT_DIR/docker/Dockerfile -d ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}
only:
- tags
chart-build-tag:
stage: chart-build
script:
- chart_build
only:
- tags
.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
export_commit_tag
before_script:
- *auto_devops