Allow switching config location in Helm Chart

Signed-off-by: Steven Kriegler <sk.bunsenbrenner@gmail.com>
This commit is contained in:
justusbunsi 2022-05-22 13:23:23 +02:00
parent 92b0b9e1db
commit 62e1be3757
No known key found for this signature in database
GPG key ID: 82B29BF2507F9F8B
4 changed files with 48 additions and 15 deletions

View file

@ -2,8 +2,8 @@ apiVersion: v2
name: gitea-sonarqube-bot
description: A Helm Chart for running a bot to communicate between both Gitea and SonarQube
type: application
version: 0.1.2
appVersion: "v0.1.1"
version: 0.2.0
appVersion: "v0.2.0"
home: https://codeberg.org/justusbunsi/gitea-sonarqube-bot/
maintainers:
- name: Steven Kriegler

View file

@ -1,5 +1,19 @@
# Gitea SonarQube Bot
_Gitea SonarQube Bot_ is a bot that receives messages from both SonarQube and Gitea to help developers
being productive. The idea behind this project is the missing ALM integration of Gitea in SonarQube. Unfortunately,
this [won't be added in near future](https://github.com/SonarSource/sonarqube/pull/3248#issuecomment-701334327).
_Gitea SonarQube Bot_ aims to fill the gap between working on pull requests and being notified on quality changes.
- [Gitea SonarQube Bot](#gitea-sonarqube-bot)
- [Installation](#installation)
- [Parameters](#parameters)
- [Common parameters](#common-parameters)
- [App parameters](#app-parameters)
- [Security parameters](#security-parameters)
- [Traffic exposure parameters](#traffic-exposure-parameters)
- [License](#license)
## Installation
```bash
@ -35,18 +49,19 @@ for full configuration options.
### App parameters
| Name | Description | Value |
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| `app.configuration.gitea.url` | Endpoint of your Gitea instance. Must be expandable by '/api/v1' to form the API base path as shown in Swagger UI. | `""` |
| `app.configuration.gitea.token.value` | Gitea token as plain text. Can be replaced with `file` key containing path to file. | `""` |
| `app.configuration.sonarqube.url` | Endpoint of your SonarQube instance. Must be expandable by '/api' to form the API base path. | `""` |
| `app.configuration.sonarqube.token.value` | SonarQube token as plain text. Can be replaced with `file` key containing path to file. | `""` |
| `app.configuration.sonarqube.additionalMetrics` | Setting this option you can extend that default list by your own metrics. | `[]` |
| `app.configuration.projects[0].sonarqube.key` | Project key inside SonarQube | `""` |
| `app.configuration.projects[0].gitea.owner` | Repository owner inside Gitea | `""` |
| `app.configuration.projects[0].gitea.name` | Repository name inside Gitea | `""` |
| `volumes` | If token and webhook secrets shall be provided via file, volumes and volume mounts can be configured to setup the environment accordingly | `[]` |
| `volumeMounts` | If token and webhook secrets shall be provided via file, volumes and volume mounts can be configured to setup the environment accordingly | `[]` |
| Name | Description | Value |
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| `app.configLocationOverride` | Override the default location of the configuration file (`/home/bot/config/config.yaml`). **Available since Chart version `0.2.0`. Requires at least image tag `v0.2.0`**. (See values file for details) | `""` |
| `app.configuration.gitea.url` | Endpoint of your Gitea instance. Must be expandable by '/api/v1' to form the API base path as shown in Swagger UI. | `""` |
| `app.configuration.gitea.token.value` | Gitea token as plain text. Can be replaced with `file` key containing path to file. | `""` |
| `app.configuration.sonarqube.url` | Endpoint of your SonarQube instance. Must be expandable by '/api' to form the API base path. | `""` |
| `app.configuration.sonarqube.token.value` | SonarQube token as plain text. Can be replaced with `file` key containing path to file. | `""` |
| `app.configuration.sonarqube.additionalMetrics` | Setting this option you can extend that default list by your own metrics. | `[]` |
| `app.configuration.projects[0].sonarqube.key` | Project key inside SonarQube | `""` |
| `app.configuration.projects[0].gitea.owner` | Repository owner inside Gitea | `""` |
| `app.configuration.projects[0].gitea.name` | Repository name inside Gitea | `""` |
| `volumes` | If token and webhook secrets shall be provided via file, volumes and volume mounts can be configured to setup the environment accordingly | `[]` |
| `volumeMounts` | If token and webhook secrets shall be provided via file, volumes and volume mounts can be configured to setup the environment accordingly | `[]` |
### Security parameters
@ -79,4 +94,4 @@ for full configuration options.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for the full license text.
This project is licensed under the MIT License. See the [LICENSE](https://codeberg.org/justusbunsi/gitea-sonarqube-bot/src/branch/main/helm/LICENSE) file for the full license text.

View file

@ -31,6 +31,11 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.app.configLocationOverride }}
env:
- name: GITEA_SQ_BOT_CONFIG_PATH
value: "{{ .Values.app.configLocationOverride }}"
{{- end}}
ports:
- name: http
containerPort: 3000
@ -47,7 +52,11 @@ spec:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: sq-bot-config
{{- if .Values.app.configLocationOverride }}
mountPath: {{ dir .Values.app.configLocationOverride }}
{{- else }}
mountPath: /home/bot/config
{{- end }}
readOnly: true
{{- if .Values.volumeMounts }}
{{- toYaml .Values.volumeMounts | nindent 12 }}
@ -68,6 +77,11 @@ spec:
- name: sq-bot-config
secret:
secretName: {{ include "helm.fullname" . }}
{{- if .Values.app.configLocationOverride }}
items:
- key: config.yaml
path: {{ base .Values.app.configLocationOverride }}
{{- end }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}

View file

@ -53,6 +53,10 @@ podAnnotations: {}
# @section App parameters
app:
# @param app.configLocationOverride Override the default location of the configuration file (`/home/bot/config/config.yaml`). **Available since Chart version `0.2.0`. Requires at least image tag `v0.2.0`**. (See values file for details)
# Setting this will also change the mount point for `.Values.app.configuration` to the directory part of the override value.
configLocationOverride: ""
# This object represents the [config.yaml](https://codeberg.org/justusbunsi/gitea-sonarqube-bot/src/branch/main/config/config.example.yaml) provided to the application.
configuration:
# Gitea related configuration. Necessary for adding/updating comments on repository pull requests