Skip to content

Commit 08c2c1e

Browse files
authored
Add support for Gitea (#436)
Signed-off-by: Pascal Bachor <[email protected]> Co-authored-by: Pascal Bachor <[email protected]>
1 parent 329b842 commit 08c2c1e

10 files changed

+117
-1
lines changed

Diff for: charts/atlantis/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: v1
33
appVersion: v0.30.0
44
description: A Helm chart for Atlantis https://www.runatlantis.io
55
name: atlantis
6-
version: 5.9.1
6+
version: 5.10.0
77
keywords:
88
- terraform
99
home: https://www.runatlantis.io

Diff for: charts/atlantis/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ In order for Atlantis to start and run successfully:
4343

4444
1. At least one of the following sets of credentials must be defined:
4545
- `github`
46+
- `gitea`
4647
- `gitlab`
4748
- `bitbucket`
4849
- `azuredevops`
@@ -113,6 +114,7 @@ extraManifests:
113114
| gitconfig | string | `""` | When referencing Terraform modules in private repositories, it may be helpful (necessary?) to use redirection in a .gitconfig. Check values.yaml for examples. |
114115
| gitconfigReadOnly | bool | `true` | When true gitconfig file is mounted as read only. When false, the gitconfig value will be copied to '/home/atlantis/.gitconfig' before starting the atlantis process, instead of being mounted as a file. |
115116
| gitconfigSecretName | string | `""` | If managing secrets outside the chart for the gitconfig, use this variable to reference the secret name |
117+
| gitea | object | `{}` | If using Gitea, please enter your values as follows. The 'baseUrl' key is exclusive to self-hosted Gitea installations. The chart will perform the base64 encoding for you for values that are stored in secrets. Check values.yaml for examples. |
116118
| github | object | `{}` | If using GitHub, please enter your values as follows. The chart will perform the base64 encoding for values that are stored in secrets. The 'hostname' key is exclusive to GitHub Enterprise installations. Check values.yaml for examples. |
117119
| githubApp | object | `{}` | If using a GitHub App, please enter your values as follows. The chart will perform the base64 encoding for you for values that are stored in secrets. installationId is necessary when there are multiple installs of the Github App. Check values.yaml for examples. |
118120
| gitlab | object | `{}` | If using GitLab, please enter your values as follows. The 'hostname' key is exclusive to GitLab Enterprise installations. The chart will perform the base64 encoding for you for values that are stored in secrets. Check values.yaml for examples. |

Diff for: charts/atlantis/README.md.gotmpl

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ In order for Atlantis to start and run successfully:
3636

3737
1. At least one of the following sets of credentials must be defined:
3838
- `github`
39+
- `gitea`
3940
- `gitlab`
4041
- `bitbucket`
4142
- `azuredevops`

Diff for: charts/atlantis/templates/NOTES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
2. Atlantis will not start successfully unless at least one of the following sets of credentials are specified (see values.yaml for detailed usage):
2121
- github
2222
- githubApp
23+
- gitea
2324
- gitlab
2425
- bitbucket

Diff for: charts/atlantis/templates/secret-webhook.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ data:
1919
github_token: {{ required "github.token is required if github configuration is specified." .Values.github.token | b64enc }}
2020
github_secret: {{ required "github.secret is required if github configuration is specified." .Values.github.secret | b64enc }}
2121
{{- end }}
22+
{{- if .Values.gitea }}
23+
gitea_token: {{ required "gitea.token is required if gitea configuration is specified." .Values.gitea.token | b64enc }}
24+
gitea_secret: {{ required "gitea.secret is required if gitea configuration is specified." .Values.gitea.secret | b64enc }}
25+
{{- end }}
2226
{{- if .Values.gitlab }}
2327
gitlab_token: {{ required "gitlab.token is required if gitlab configuration is specified." .Values.gitlab.token | b64enc }}
2428
gitlab_secret: {{ required "gitlab.secret is required if gitlab configuration is specified." .Values.gitlab.secret | b64enc }}

Diff for: charts/atlantis/templates/statefulset.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,24 @@ spec:
392392
value: "/var/github-app/key.pem"
393393
{{- end }}
394394
{{- end }}
395+
{{- if .Values.gitea }}
396+
- name: ATLANTIS_GITEA_USER
397+
value: {{ required "gitea.user is required if gitea configuration is specified." .Values.gitea.user }}
398+
- name: ATLANTIS_GITEA_TOKEN
399+
valueFrom:
400+
secretKeyRef:
401+
name: {{ template "atlantis.vcsSecretName" . }}
402+
key: gitea_token
403+
- name: ATLANTIS_GITEA_WEBHOOK_SECRET
404+
valueFrom:
405+
secretKeyRef:
406+
name: {{ template "atlantis.vcsSecretName" . }}
407+
key: gitea_secret
408+
{{- if .Values.gitea.baseUrl }}
409+
- name: ATLANTIS_GITEA_BASE_URL
410+
value: {{ .Values.gitea.baseUrl }}
411+
{{- end }}
412+
{{- end }}
395413
{{- if .Values.gitlab }}
396414
- name: ATLANTIS_GITLAB_USER
397415
value: {{ required "gitlab.user is required if gitlab configuration is specified." .Values.gitlab.user }}

Diff for: charts/atlantis/tests/secret-webhook_test.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,33 @@ tests:
8282
value:
8383
github_secret: YmF6
8484
github_token: YmFy
85+
- it: gitea only user set
86+
set:
87+
gitea:
88+
user: foo
89+
asserts:
90+
- failedTemplate:
91+
errorMessage: gitea.token is required if gitea configuration is specified.
92+
- it: gitea only user and token are set
93+
set:
94+
gitea:
95+
user: foo
96+
token: bar
97+
asserts:
98+
- failedTemplate:
99+
errorMessage: gitea.secret is required if gitea configuration is specified.
100+
- it: gitea
101+
set:
102+
gitea:
103+
user: foo
104+
token: bar
105+
secret: baz
106+
asserts:
107+
- equal:
108+
path: data
109+
value:
110+
gitea_secret: YmF6
111+
gitea_token: YmFy
85112
- it: gitlab only user set
86113
set:
87114
gitlab:

Diff for: charts/atlantis/tests/statefulset_test.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,35 @@ tests:
639639
content:
640640
name: ATLANTIS_GH_APP_KEY_FILE
641641
value: /var/github-app/key.pem
642+
- it: gitea
643+
template: statefulset.yaml
644+
set:
645+
gitea:
646+
user: foo
647+
token: bar
648+
secret: baz
649+
asserts:
650+
- contains:
651+
path: spec.template.spec.containers[0].env
652+
content:
653+
name: ATLANTIS_GITEA_USER
654+
value: foo
655+
- contains:
656+
path: spec.template.spec.containers[0].env
657+
content:
658+
name: ATLANTIS_GITEA_TOKEN
659+
valueFrom:
660+
secretKeyRef:
661+
key: gitea_token
662+
name: my-release-atlantis-webhook
663+
- contains:
664+
path: spec.template.spec.containers[0].env
665+
content:
666+
name: ATLANTIS_GITEA_WEBHOOK_SECRET
667+
valueFrom:
668+
secretKeyRef:
669+
key: gitea_secret
670+
name: my-release-atlantis-webhook
642671
- it: gitlab
643672
template: statefulset.yaml
644673
set:

Diff for: charts/atlantis/values.schema.json

+23
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,29 @@
113113
},
114114
"additionalProperties": false
115115
},
116+
"gitea": {
117+
"type": "object",
118+
"description": "Gitea settings",
119+
"properties": {
120+
"user": {
121+
"type": "string",
122+
"description": "Name of the Atlantis Gitea user."
123+
},
124+
"token": {
125+
"type": "string",
126+
"description": "Access token of the Atlantis Gitea user."
127+
},
128+
"secret": {
129+
"type": "string",
130+
"description": "Webhook secret for the Atlantis Gitea integration. All repositories in Gitea that are to be integrated with Atlantis must share the same value."
131+
},
132+
"baseUrl": {
133+
"type": "string",
134+
"description": "Base URL of your Gitea installation."
135+
}
136+
},
137+
"additionalProperties": false
138+
},
116139
"gitlab": {
117140
"type": "object",
118141
"description": "GitLab settings",

Diff for: charts/atlantis/values.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ githubApp: {}
5050
# -----END PRIVATE KEY-----
5151
# secret: baz
5252

53+
# -- If using Gitea, please enter your values as follows.
54+
# The 'baseUrl' key is exclusive to self-hosted Gitea installations.
55+
# The chart will perform the base64 encoding for you for values that are stored in secrets.
56+
# Check values.yaml for examples.
57+
gitea: {}
58+
# gitea:
59+
# user: foo
60+
# token: bar
61+
# secret: baz
62+
# baseUrl: gitea.your.org
63+
5364
# -- If using GitLab, please enter your values as follows.
5465
# The 'hostname' key is exclusive to GitLab Enterprise installations.
5566
# The chart will perform the base64 encoding for you for values that are stored in secrets.

0 commit comments

Comments
 (0)