forked from enix/san-iscsi-csi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
105 lines (99 loc) · 3.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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright (c) 2021 Enix, SAS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# Authors:
# Paul Laffitte <[email protected]>
# Arthur Chaloin <[email protected]>
# Alexandre Buisine <[email protected]>
stages:
- build
- release
build dirty docker image:
stage: build
image: docker:stable
services:
- docker:dind
before_script:
- apk add --update make git
- docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWORD"
script:
- VERSION=dirty make push
rules:
- if: $CI_COMMIT_TAG == null && $CI_COMMIT_MESSAGE !~ /^chore\(release\):/
build and push:
stage: release
image: docker:stable
services:
- docker:dind
before_script:
- apk add --update make
- docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWORD"
script:
- VERSION="$CI_COMMIT_TAG" make push
- docker tag "enix/san-iscsi-csi:$CI_COMMIT_TAG" enix/san-iscsi-csi
- docker push enix/san-iscsi-csi
only:
- tags
push helm chart:
stage: release
image: golang:alpine3.12
before_script:
- GO111MODULE=on go get github.com/norwoodj/helm-docs/cmd/helm-docs
- apk add --update git openssh
- eval $(ssh-agent -s)
- cat "$GITHUB_DEPLOY_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- git config --global user.email "[email protected]"
- git config --global user.name "Monkeynator"
script:
- git clone --single-branch --branch master [email protected]:enix/helm-charts.git
- rm -rf ./helm-charts/charts/san-iscsi-csi
- cp ./LICENSE ./helm/san-iscsi-csi/
- cp -R ./helm/san-iscsi-csi ./helm-charts/charts/san-iscsi-csi
- cd ./helm-charts/charts/san-iscsi-csi
- >
sed -i
-e "s/version: 0\.0\.0-DIRTY/version: ${CI_COMMIT_TAG:1}/g"
-e "s/appVersion: 0\.0\.0-DIRTY/appVersion: $CI_COMMIT_TAG/g"
-e "s/image: enix\/san-iscsi-csi:0\.0\.0-DIRTY/image: enix\/san-iscsi-csi:$CI_COMMIT_TAG/g"
./Chart.yaml
- helm-docs
- rm ./README.md.gotmpl
- git add --all
- >
git commit -m "bump(san-iscsi-csi): bump chart version to $CI_COMMIT_TAG"
- git push --set-upstream origin master
only:
- tags
release-candidate:
stage: release
image: docker:stable
services:
- docker:dind
before_script:
- apk add --update make
- docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWORD"
script:
- VERSION="rc-$CI_PIPELINE_ID" make push
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TAG == null && $CI_COMMIT_MESSAGE !~ /^chore\(release\):/
semantic-release:
stage: release
image: enix/semantic-release:gitlab
script:
- npx semantic-release --ci
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TAG == null && $CI_COMMIT_MESSAGE !~ /^chore\(release\):/
when: manual