Skip to content

Commit 696948f

Browse files
authored
Added helm chart (#55)
1 parent cae9f39 commit 696948f

File tree

6 files changed

+158
-1
lines changed

6 files changed

+158
-1
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/lib
44
/data
55
/gitlab-merger-bot
6+
/charts

.github/workflows/tests.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
node-version: [12.x]
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v1
1414
- name: Use Node.js ${{ matrix.node-version }}
1515
uses: actions/setup-node@v1
1616
with:
@@ -30,3 +30,21 @@ jobs:
3030

3131
- name: Test
3232
run: yarn run check:tests
33+
34+
- name: Check Helm Chart
35+
id: lint
36+
uses: helm/[email protected]
37+
with:
38+
command: lint
39+
40+
- name: Create kind cluster
41+
uses: helm/[email protected]
42+
with:
43+
install_local_path_provisioner: true
44+
# Only build a kind cluster if there are chart changes to test.
45+
if: steps.lint.outputs.changed == 'true'
46+
47+
- name: Check Helm Install
48+
uses: helm/[email protected]
49+
with:
50+
command: install
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
appVersion: "1.0"
3+
description: A Helm chart for Kubernetes
4+
name: gitlab-merger-bot
5+
version: 1.2.0
6+
home: https://github.com/pepakriz/gitlab-merger-bot
7+
maintainers:
8+
- name: pepakriz
9+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "gitlab-merger-bot.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "gitlab-merger-bot.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "gitlab-merger-bot.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "gitlab-merger-bot.fullname" . }}
5+
{{- if .Values.annotations }}
6+
annotations:
7+
{{ toYaml .Values.annotations | indent 4 }}
8+
{{- end }}
9+
labels:
10+
app: {{ include "gitlab-merger-bot.name" . }}
11+
chart: {{ include "gitlab-merger-bot.chart" . }}
12+
heritage: {{ .Release.Service }}
13+
release: {{ .Release.Name }}
14+
{{- if .Values.labels }}
15+
{{ toYaml .Values.labels | indent 4 }}
16+
{{- end }}
17+
spec:
18+
replicas: {{ .Values.replicaCount }}
19+
selector:
20+
matchLabels:
21+
app: {{ include "gitlab-merger-bot.name" . }}
22+
release: {{ .Release.Name }}
23+
strategy:
24+
type: Recreate # stop app before update
25+
template:
26+
metadata:
27+
{{- if .Values.podAnnotations }}
28+
annotations:
29+
{{ toYaml .Values.podAnnotations | indent 8 }}
30+
{{- end }}
31+
labels:
32+
app: {{ include "gitlab-merger-bot.name" . }}
33+
release: {{ .Release.Name }}
34+
spec:
35+
containers:
36+
- name: {{ .Chart.Name }}
37+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
38+
imagePullPolicy: {{ .Values.image.pullPolicy }}
39+
env:
40+
- name: GITLAB_AUTH_TOKEN
41+
value: "{{ .Values.settings.authToken }}"
42+
- name: GITLAB_URL
43+
value: "{{ .Values.settings.gitlabUrl }}"
44+
- name: CI_CHECK_INTERVAL
45+
value: "{{ .Values.settings.ciCheckInterval }}"
46+
- name: MR_CHECK_INTERVAL
47+
value: "{{ .Values.settings.mrCheckInterval }}"
48+
- name: SENTRY_DSN
49+
value: "{{ .Values.settings.sentryDsn }}"
50+
- name: SKIP_SQUASHING_LABEL
51+
value: "{{ .Values.settings.skipSquashingLabel }}"
52+
- name: HI_PRIORITY_LABEL
53+
value: "{{ .Values.settings.hiPriorityLabel }}"
54+
resources:
55+
{{ toYaml .Values.resources | indent 10 }}
56+
{{- if .Values.nodeSelector }}
57+
nodeSelector:
58+
{{ toYaml .Values.nodeSelector | indent 8 }}
59+
{{- end }}
60+
{{- if .Values.tolerations }}
61+
tolerations:
62+
{{ toYaml .Values.tolerations | indent 8 }}
63+
{{- end }}
64+
{{- if .Values.affinity }}
65+
affinity:
66+
{{ toYaml .Values.affinity | indent 8 }}
67+
{{- end }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
replicaCount: 1
2+
restartPolicy: Never
3+
4+
image:
5+
repository: pepakriz/gitlab-merger-bot
6+
tag: latest
7+
pullPolicy: IfNotPresent
8+
9+
resources:
10+
requests:
11+
cpu: 50m
12+
memory: 64Mi
13+
limits:
14+
cpu: 150m
15+
memory: 64Mi
16+
17+
annotations: {}
18+
labels: {}
19+
nodeSelector: {}
20+
tolerations: []
21+
podAnnotations: {}
22+
23+
settings:
24+
gitlabUrl: "https://gitlab.com"
25+
authToken: ""
26+
sentryDsn: ""
27+
ciCheckInterval: 10
28+
mrCheckInterval: 20
29+
skipSquashingLabel: ""
30+
hiPriorityLabel: ""

0 commit comments

Comments
 (0)