-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
91 lines (83 loc) · 2.33 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
stages:
- test
- build
- pre-release
- release
include:
project: efficiency/gitlab-ci-template
file: templates/.common.gitlab-ci.yml
variables:
CLOSE_SONAR_SCAN: 'true'
lint:
image: docker.bizseer.com/golangci/golangci-lint:v1.30
stage: test
script:
- golangci-lint run
.only_release:
only:
- /^v[0-9]+\.[0-9]+\.[0-9]+$/i
except:
- branches
build:
image: docker.bizseer.com/library/golang:1.14
stage: build
script:
- export WALLE_VERSION=${CI_BUILD_REF_NAME:1}
- echo $WALLE_VERSION
- make bin/walle
- ./bin/walle version
extends:
- .only_release
artifacts:
paths:
- bin/
binary:
image: docker.bizseer.com/bizseer/ossutil:1.7.0
stage: pre-release
variables:
OSS_ENDPOINT: http://oss-cn-beijing-internal.aliyuncs.com
RELEASE_PATH: oss://bizseer-public/release/walle
before_script:
- ossutil --version
- ossutil config -e $OSS_ENDPOINT -i $ACCESS_KEY_ID -k $ACCESS_KEY_SECRET
script:
- export WALLE_VERSION=${CI_BUILD_REF_NAME:1}
- echo $WALLE_VERSION
- WALLE_RELEASE_PATH=$RELEASE_PATH/$WALLE_VERSION/walle
- echo $WALLE_RELEASE_PATH
- ossutil cp bin/walle $WALLE_RELEASE_PATH
- echo $WALLE_RELEASE_PATH > bin/links.txt
extends:
- .only_release
docker_image:
stage: release
image:
name: docker.bizseer.com/kaniko-project/executor:v1.3.0-debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- export VERSION=${CI_BUILD_REF_NAME:1}
- TAG=$CI_REGISTRY/bizseer/walle:$VERSION
- echo $TAG
- |
/kaniko/executor \
--context $CI_PROJECT_DIR/docker \
--dockerfile $CI_PROJECT_DIR/docker/Dockerfile \
--destination $TAG \
--build-arg VERSION=$VERSION
extends:
- .only_release
release_note:
image: alpine:3.12.3
stage: release
extends:
- .only_release
before_script:
- cp bin/walle /usr/local/bin/walle
- chmod a+x /usr/local/bin/walle
script:
- walle version
- export WALLE_GITLAB_HOST=$CI_SERVER_URL
- walle release -p $CI_PROJECT_PATH --ref $CI_COMMIT_SHA -t $CI_BUILD_REF_NAME
- walle changelog -p $CI_PROJECT_PATH --ref $CI_COMMIT_SHA -t $CI_BUILD_REF_NAME --assignee $GITLAB_USER_ID