You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 39b0080
Browse filesBrowse the repository at this point in the historyBrowse files
ginkgo now used for testing cli instead of bash
go version bump to 1.25
module names updated to reflect validatedpatterns org
anisble cfg updated to ignore unparsed inventory warning
isHubCluster removed since it is deprecated in clustergroup chart
patternizer version bump to 1.0.0
uninstall added as a makefile target in common makefile
**Patternizer** is a command-line tool that bootstraps a Git repository containing Helm charts into a ready-to-use Validated Pattern. It automatically generates the necessary scaffolding, configuration files, and utility scripts, so you can get your pattern up and running in minutes.
7
+
**Patternizer** is a command-line tool that bootstraps a Git repository containing Helm charts into a ready-to-use Validated Pattern. It automatically generates the necessary scaffolding, configuration files, and utility scripts, so you can get your pattern up and running in minutes. It can also be used to upgrade existing patterns as described in [the Validated Pattern's blog](https://validatedpatterns.io/blog/2025-08-29-new-common-makefile-structure/).
8
8
9
-
> **Note:** This tool was developed with assistance from [Cursor](https://cursor.sh), an AI-powered code editor.
9
+
**Note:** This repo was developed with AI tools including [Cursor](https://cursor.com/), [Claude](https://claude.ai/login) and [Gemini](https://gemini.google.com/app).
podman run -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init
54
+
podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init
72
55
```
73
56
74
-
3. **Review, commit, and push the generated files:**
57
+
3. **Review, commit, and push the generated files**
75
58
76
59
```bash
77
60
git status
@@ -80,7 +63,13 @@ This single command will generate all the necessary files to turn your repositor
80
63
git push -u origin initialize-pattern
81
64
```
82
65
83
-
4. **Install the pattern:**
66
+
4. **Login to an OpenShift cluster**
67
+
68
+
```bash
69
+
export KUBECONFIG=/path/to/cluster/kubeconfig
70
+
```
71
+
72
+
5. **Install the pattern**
84
73
85
74
```bash
86
75
./pattern.sh make install
@@ -90,18 +79,18 @@ This single command will generate all the necessary files to turn your repositor
90
79
91
80
### Container Usage (Recommended)
92
81
93
-
Using the prebuilt container is the easiest way to run Patternizer, as it requires no local installation. The `-v "$PWD:$PWD:z" -w "$PWD"` flag mounts your current directory into the container's `/repo` workspace.
82
+
Using the prebuilt container is the easiest way to run Patternizer, as it requires no local installation.
94
83
95
84
#### **Initialize without secrets:**
96
85
97
86
```bash
98
-
podman run -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init
87
+
podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init
99
88
```
100
89
101
90
#### **Initialize with secrets support:**
102
91
103
92
```bash
104
-
podman run -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init --with-secrets
93
+
podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init --with-secrets
105
94
```
106
95
107
96
#### **Upgrade an existing pattern repository:**
@@ -110,19 +99,18 @@ Use this to migrate or refresh an existing pattern repo to the latest common str
110
99
111
100
```bash
112
101
# Refresh common assets, keep your Makefile unless it lacks the include
113
-
podman run -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer upgrade
102
+
podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer upgrade
114
103
115
104
# Replace your Makefile with the default from Patternizer
116
-
podman run -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer upgrade --replace-makefile
105
+
podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer upgrade --replace-makefile
117
106
```
118
107
119
108
What upgrade does:
120
109
121
110
- Removes the `common/` directory if it exists
122
-
- Removes `./pattern.sh` if it exists (symlink or file)
123
-
- Copies `resources/Makefile-common` and `resources/pattern.sh` into the repo root
111
+
- Updates `ansible.cfg`, `Makefile-common`, and `pattern.sh` to the latest versions from [the resources directory](./resources/)
124
112
- Makefile handling:
125
-
- If `--replace-makefile` is set: copies the default `Makefile` into the repo root (overwriting any existing one)
113
+
- If `--replace-makefile` is set: replaces an existing Makefile, if present, to [`Makefile`](./resources/Makefile) from the resources directory
126
114
- If not set:
127
115
- If no `Makefile` exists: copies the default `Makefile`
128
116
- If a `Makefile` exists and already contains `include Makefile-common` anywhere: leaves it unchanged
@@ -147,6 +135,7 @@ Running `patternizer init` creates the following:
147
135
- `pattern.sh`: A utility script for common pattern operations (`install`, `upgrade`, etc.).
148
136
- `Makefile`: A simple Makefile that includes `Makefile-common`.
149
137
- `Makefile-common`: The core Makefile with all pattern-related targets.
138
+
- `ansible.cfg`: Configuration for the ansible installation used when `./pattern.sh` is called
150
139
151
140
Using the `--with-secrets` flag additionally creates:
152
141
@@ -159,7 +148,7 @@ This section is for developers who want to contribute to the Patternizer project
159
148
160
149
### Prerequisites
161
150
162
-
- Go (see `go.mod` for version)
151
+
- Go (see [`go.mod`](./src/go.mod)for version)
163
152
- Podman or Docker
164
153
- Git
165
154
- Make
@@ -168,10 +157,10 @@ This section is for developers who want to contribute to the Patternizer project
- `make test`: Run all tests (unit and integration).
191
-
- `make test-unit`: Run unit tests only.
192
-
- `make test-integration`: Run integration tests only.
193
-
- `make lint`: Run all code quality checks.
194
-
- `make amd64`: Build the amd64 container image locally.
195
-
- `make arm64`: Build the arm64 container image locally.
196
-
197
-
### Testing Strategy
198
-
199
-
Patternizer has a comprehensive test suite to ensure stability and correctness.
200
-
201
-
- **Unit Tests:** Located alongside the code they test (e.g., `src/internal/helm/helm_test.go`), these tests cover individual functions and packages in isolation. They validate Helm chart detection, Git URL parsing, and YAML processing logic.
202
-
- **Integration Tests:** The integration test suite (`test/integration_test.sh`) validates the end-to-end CLI workflow against a real Git repository. Key scenarios include:
203
-
1. **Basic Init:** Validates default file generation without secrets.
204
-
2. **Init with Secrets:** Ensures secrets-related applications and files are correctly added.
205
-
3. **Configuration Preservation:** Verifies that existing custom values are preserved when the tool is re-run.
206
-
4. **Sequential Execution:** Tests running `init` and then `init --with-secrets` to ensure a clean upgrade.
207
-
5. **Selective File Overwriting:** Confirms that running `init` on a repository with pre-existing custom files correctly **merges YAML configurations**, preserves user-modified files (like `Makefile` and `values-secret.yaml.template`), and only overwrites essential, generated scripts (`pattern.sh`, `Makefile-common`).
208
-
6. **Mixed State Handling:** Validates that the tool correctly initializes a partially-configured repository, **creating files that are missing** while leaving existing ones untouched.
209
-
7. **Upgrade (no replace):** Removes legacy `common/` and `pattern.sh` symlink, copies `Makefile-common`/`pattern.sh`, and injects `include Makefile-common` at the top of `Makefile` when missing.
210
-
8. **Upgrade (include present):** Leaves the existing `Makefile` unchanged when it already contains `include Makefile-common` anywhere.
211
-
9. **Upgrade with `--replace-makefile`:** Replaces `Makefile` with the default and refreshes common assets.
212
-
10. **Upgrade (no Makefile present):** Creates the default `Makefile` and refreshes common assets when a `Makefile` does not exist.
213
-
214
-
### Architecture
215
-
216
-
The CLI is organized into focused packages following Go best practices, with a clean separation of concerns between command-line logic (`cmd`), core business logic (`internal`), and file operations (`fileutils`). This modular design makes the codebase maintainable, testable, and extensible.
217
-
218
-
### CI/CD Pipeline
219
-
220
-
The GitHub Actions pipeline (`.github/workflows/ci.yaml`) runs on every push and pull request. It uses the same `Makefile` targets that developers use locally, ensuring perfect consistency between local and CI environments.
0 commit comments