Skip to content

Commit

Permalink
docs(atlantis): use auto generated docs (#371)
Browse files Browse the repository at this point in the history
* docs(atlantis): use auto generated docs
  • Loading branch information
GMartinez-Sisti committed Mar 30, 2024
1 parent a05b469 commit 2895061
Show file tree
Hide file tree
Showing 11 changed files with 874 additions and 530 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- 'charts/atlantis/**'
- 'ct.yaml'

defaults:
run:
shell: bash

jobs:
lint-test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -39,10 +43,25 @@ jobs:
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: install helm unittests
- name: Check if docs are updated
if: steps.list-changed.outputs.changed == 'true'
run: |
helm plugin install --version v0.3.6 https://github.com/helm-unittest/helm-unittest
make docs
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
echo "Documentation not up to date." >&2
echo "Please run 'make docs' from the repository root and commit changes!" >&2
git diff
exit 1
else
echo "Documentation is up to date." >&2
fi
- name: Install helm unittests
if: steps.list-changed.outputs.changed == 'true'
run: |
make unit-test-install
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: |
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/sync-readme.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.DEFAULT_GOAL := help

.PHONY: help
help: ## List targets & descriptions
@cat Makefile* | grep -E '^[a-zA-Z\/_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: docs
docs: ## Build helm chart documentation
@docker pull jnorwood/helm-docs:latest
@docker run --rm --volume "$$(pwd):/helm-docs" -u $$(id -u) jnorwood/helm-docs:latest

.PHONY: unit-test-install
unit-test-install:
@helm plugin list | grep unittest || helm plugin install --version v0.3.6 https://github.com/helm-unittest/helm-unittest

.PHONY: unit-test-run-atlantis
unit-test-run-atlantis: unit-test-install ## Run unit tests for Atlantis
@helm unittest ./charts/atlantis
262 changes: 11 additions & 251 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion charts/atlantis/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
appVersion: v0.27.2
description: A Helm chart for Atlantis https://www.runatlantis.io
name: atlantis
version: 4.23.6
version: 4.24.0
keywords:
- terraform
home: https://www.runatlantis.io
Expand Down
321 changes: 321 additions & 0 deletions charts/atlantis/README.md

Large diffs are not rendered by default.

155 changes: 155 additions & 0 deletions charts/atlantis/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Atlantis

[Atlantis](https://www.runatlantis.io/) is a tool for safe collaboration on [Terraform](https://www.terraform.io/) repositories.

{{ template "chart.maintainersSection" . }}

{{ template "chart.requirementsSection" . }}

## Links

- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Required Configuration](#required-configuration)
- [Additional manifests](#additional-manifests)
- [Values](#values)
- [Upgrading](#upgrading)
- [From `2.*` to `3.*`](#from-2-to-3)
- [From `1.*` to `2.*`](#from-1-to-2)
- [Testing the Deployment](#testing-the-deployment)
- [Update documentation](#update-documentation)
- [Run unit tests](#run-unit-tests)

## Introduction

This chart creates a single pod in a StatefulSet running Atlantis. Atlantis persists Terraform [plan files](https://www.terraform.io/docs/commands/plan.html) and [lockfiles](https://www.terraform.io/docs/state/locking.html) to disk for the duration of a Pull/Merge Request. These files are stored in a PersistentVolumeClaim to survive Pod failures.

## Prerequisites

- Kubernetes 1.9+
- PersistentVolume support

## Required Configuration

In order for Atlantis to start and run successfully:

1. At least one of the following sets of credentials must be defined:
- `github`
- `gitlab`
- `bitbucket`
- `azuredevops`

Refer to [values.yaml](/charts/atlantis/values.yaml) for detailed examples.
They can also be provided directly through a Kubernetes `Secret`, use the variable `vcsSecretName` to reference it.

1. Supply a value for `orgAllowlist`, e.g. `github.com/myorg/*`.

## Additional manifests

It is possible to add additional manifests into a deployment, to extend the chart. One of the reason is to deploy a manifest specific to a cloud provider ( BackendConfig on GKE for example ).

```yaml
extraManifests:
- apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
name: "{{ `.Release.Name` }}-test"
spec:
securityPolicy:
name: "gcp-cloud-armor-policy-test"
```

{{ template "chart.valuesSection" . }}

## Upgrading

### From `4.0.*` to `4.1.*`

- The following value are deprecated:
- `dataStorage`
- `storageClassName`

- In favor of the new working way:
- `volumeClaim.enabled`
- `volumeClaim.dataStorage`
- `volumeClaim.storageClassName`

### From `2.*` to `3.*`

- The following value names have been removed. They are replaced by [Server-side Repository Configuration](https://www.runatlantis.io/docs/server-side-repo-config.html)
- `requireApproval`
- `requireMergeable`
- `allowRepoConfig`

To replicate your previous configuration, run Atlantis locally with your previous flags and Atlantis will print out the equivalent repo-config, for example:

```bash
$ atlantis server --allow-repo-config --require-approval --require-mergeable --gh-user=foo --gh-token=bar --repo-allowlist='*'
WARNING: Flags --require-approval, --require-mergeable and --allow-repo-config have been deprecated.
Create a --repo-config file with the following config instead:

---
repos:
- id: /.*/
apply_requirements: [approved, mergeable]
allowed_overrides: [apply_requirements, workflow]
allow_custom_workflows: true

or use --repo-config-json='{"repos":[{"id":"/.*/", "apply_requirements":["approved", "mergeable"], "allowed_overrides":["apply_requirements","workflow"], "allow_custom_workflows":true}]}'
```

Then use this YAML in the new repoConfig value:

```yaml
repoConfig: |
---
repos:
- id: /.*/
apply_requirements: [approved, mergeable]
allowed_overrides: [apply_requirements, workflow]
allow_custom_workflows: true
```

### From `1.*` to `2.*`

- The following value names have changed:
- `allow_repo_config` => `allowRepoConfig`
- `atlantis_data_storage` => `dataStorage` **NOTE: more than just a snake_case change**
- `atlantis_data_storageClass` => `storageClassName` **NOTE: more than just a snake_case change**
- `bitbucket.base_url` => `bitbucket.baseURL`

## Testing the Deployment

To perform a smoke test of the deployment (i.e. ensure that the Atlantis UI is up and running):

1. Install the chart. Supply your own values file or use `test-values.yaml`, which has a minimal set of values required in order for Atlantis to start.

```bash
helm repo add runatlantis https://runatlantis.github.io/helm-charts
helm install -f test-values.yaml my-atlantis runatlantis/atlantis --debug
```

1. Run the tests:

```bash
helm test my-atlantis
```

## Update documentation

Documentations is auto-generated using [helm-docs](https://github.com/norwoodj/helm-docs).

To update run the follwogin (from the root path of the repository):

1. If required, update `charts/atlantis/README.md.gotmpl`
2. Run `make docs`

## Run unit tests

From the root of the repository, run:

```sh
make unit-test-run-atlantis
```

{{ template "helm-docs.versionFooter" . }}
2 changes: 1 addition & 1 deletion charts/atlantis/templates/secret-basic-auth.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (not .Values.basicAuthSecretName) .Values.basicAuth }}
{{- if and (not .Values.basicAuthSecretName) .Values.basicAuth.username .Values.basicAuth.password }}
apiVersion: v1
kind: Secret
metadata:
Expand Down
2 changes: 1 addition & 1 deletion charts/atlantis/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ spec:
name: {{ template "atlantis.vcsSecretName" . }}
key: azuredevops_webhook_password
{{- end }}
{{- if or .Values.basicAuthSecretName .Values.basicAuth }}
{{- if or .Values.basicAuthSecretName ( and .Values.basicAuth.username .Values.basicAuth.password ) }}
- name: ATLANTIS_WEB_BASIC_AUTH
value: "true"
- name: ATLANTIS_WEB_USERNAME
Expand Down
27 changes: 18 additions & 9 deletions charts/atlantis/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"additionalProperties": true
},
"fullnameOverride": {
"description": "Provide a name to substitute for the full names of resources",
"description": "Provide a name to substitute for the full names of resources.",
"type": "string",
"default": ""
},
"nameOverride": {
"description": "Override the name of the chart",
"description": "Provide a name to substitute for the name of the chart.",
"type": "string",
"default": ""
},
Expand All @@ -30,7 +30,15 @@
"orgAllowlist": {
"type": "string",
"default": "<replace-me>",
"description": "Allowlist of repositories from which Atlantis will accept webhooks",
"description": "Replace this with your own repo allowlist.",
"examples": [
"github.com/myorg/*"
]
},
"orgWhitelist": {
"type": "string",
"default": "<replace-me>",
"description": "Deprecated in favor of orgAllowlist.",
"examples": [
"github.com/myorg/*"
]
Expand All @@ -39,6 +47,7 @@
"type": "string",
"description": "Level to use for logging. Either debug, info, warn, or error.",
"enum": [
"",
"debug",
"info",
"warn",
Expand Down Expand Up @@ -325,10 +334,6 @@
"description": "Password for basic authentication"
}
},
"required": [
"username",
"password"
],
"additionalProperties": false
},
"api": {
Expand Down Expand Up @@ -576,7 +581,10 @@
}
},
"terminationGracePeriodSeconds": {
"type": "integer",
"type": [
"integer",
"null"
],
"description": "Set terminationGracePeriodSeconds for the StatefulSet."
},
"ingress": {
Expand Down Expand Up @@ -1148,8 +1156,9 @@
"lockingDbType": {
"type": "string",
"description": "Locking DB type for storing plan and apply locks. Allowed values are `boltdb` and `redis`.",
"default": "postgres",
"default": "",
"enum": [
"",
"boltdb",
"redis"
]
Expand Down
Loading

0 comments on commit 2895061

Please sign in to comment.