UNCLASSIFIED - NO CUI

Skip to content

Add pre-commit hook for readme generation and instructions in the docs

Andrew Kesterson requested to merge feature/pre_commit_readme_hook into main

General MR

Summary

This MR adds a pre-commit hook to the BigBang Vault repository that automatically regenerates the README for the chart. This reduces developer fatigue by automatically performing a frequently needed step, and saves time during the code review process by ensuring the README files are updated properly.

Relevant logs/screenshots

Installing the hooks

$ ./hooks/install.sh

Workflow with the hooks installed

$ git status
On branch feature/pre_commit_readme_hook
Your branch is up to date with 'origin/feature/pre_commit_readme_hook'.
                                                            
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed) 
  (use "git restore <file>..." to discard changes in working directory)
        modified:   chart/values.yaml
                                                            
no changes added to commit (use "git add" and/or "git commit -a")

$ git diff
diff --git a/chart/values.yaml b/chart/values.yaml
index 7d84962..db73047 100644                                                                                            
--- a/chart/values.yaml                  
+++ b/chart/values.yaml                         
@@ -3,7 +3,7 @@                                   
 global:                     
   # enabled is the master enabled switch. Setting this to true or false
   # will enable or disable all the components within this chart by default.
-  enabled: true
+  enabled: false
                                                                                                                         
   # Image pull secret to use for registry authentication.                                                               
   # Alternatively, the value may be specified as an array of strings.
@@ -1397,4 +1397,4 @@ serverTelemetry:
       #    labels:
end of file                                               
+openshift: false                                                                                                        

Here we see a change to a values.yaml file with no accompanying README change. With the hooks installed, the README is updated during the pre-commit step, and added to the changeset.

$ git commit -m "demonstration" .
time="2024-04-12T13:51:50Z" level=info msg="Found Chart directories [chart]"
time="2024-04-12T13:51:50Z" level=info msg="Generating README Documentation for chart chart"
[feature/pre_commit_readme_hook 7a42794] demonstration
 2 files changed, 3 insertions(+), 3 deletions(-)

$ git show HEAD | cat
commit 7a4279482fb8e164d3df9444366ceb78f8a69062
Author: Andrew Kesterson <akesterson@bridgephase.com>
Date:   Fri Apr 12 09:51:47 2024 -0400

    demonstration

diff --git a/README.md b/README.md
index 33ac006..030f30f 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ helm install vault chart/

 | Key | Type | Default | Description |
 |-----|------|---------|-------------|
-| global.enabled | bool | `true` |  |
+| global.enabled | bool | `false` |  |
 | global.imagePullSecrets[0].name | string | `"private-regist |
 | global.tlsDisable | bool | `true` |  |
 | global.externalVaultAddr | string | `""` |  |
diff --git a/chart/values.yaml b/chart/values.yaml
index 7d84962..db73047 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -3,7 +3,7 @@
 global:
   # enabled is the master enabled switch. Setting this to true or false
   # will enable or disable all the components within this chart by default.
-  enabled: true
+  enabled: false

   # Image pull secret to use for registry authentication.
   # Alternatively, the value may be specified as an array of strings.
@@ -1397,4 +1397,4 @@ serverTelemetry:
       #    labels:
       #      severity: critical

-openshift: false
\ No newline at end of file
+openshift: false

Linked Issue

issue

Upgrade Notices

N/A

Merge request reports