Skip to content

Commit 1dae975

Browse files
authored
Standardize Struct Syntax and Update Documentation (#25)
#### Overview This PR refactors the syntax and structure across various modules and updates associated documentation files. It also reorganizes certain YAML configurations for improved maintainability and readability. #### Changes - **Syntax Updates**: - Standardized `struct` values across modules: - Replaced `terraform-module` with `terraform/module`. - Updated folder struct labels (e.g., `go-project` to `project/go`). - **Documentation Updates**: - Revised examples in `README.md` and `README.es.md` to reflect updated struct labels. - Improved consistency in code examples and descriptions. - **Configuration File Updates**: - Moved `.github/workflows` files into dedicated subfolders. - Added missing configurations like `release-drafter.yaml`. - Removed redundant or unused YAML files. - **Renaming for Consistency**: - Renamed project contribution files (e.g., `go-project.yaml` to `project/go.yaml`) for logical categorization. #### Justification This update ensures that the project adheres to a standardized naming convention, improving clarity and consistency across the codebase. It also simplifies future maintenance and onboarding for contributors. #### Impact - **Positive**: - Reduces confusion caused by inconsistent syntax and naming. - Enhances readability of both code and documentation. - Lays a foundation for streamlined automation workflows. - **Potential Issues**: - May require contributors to adjust their local configurations to align with the new structure.
1 parent 057672f commit 1dae975

17 files changed

Lines changed: 116 additions & 70 deletions

File tree

README.es.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ structure:
166166
print("Hello, World!")
167167
folders:
168168
- .devops/modules/mod1:
169-
struct: terraform-module
169+
struct: terraform/module
170170
- .devops/modules/mod2:
171-
struct: terraform-module
171+
struct: terraform/module
172172
with:
173173
module_name: mymod2
174174
- ./:
175175
struct:
176176
- docker-files
177-
- go-project
177+
- project/go
178178
variables:
179179
- project_name:
180180
description: "The name of the project"
@@ -269,9 +269,9 @@ Ejemplo:
269269
```yaml
270270
folders:
271271
- .devops/modules/mod1:
272-
struct: terraform-module
272+
struct: terraform/module
273273
- .devops/modules/mod2:
274-
struct: terraform-module
274+
struct: terraform/module
275275
with:
276276
module_name: mymod2
277277
```

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ structure:
164164
print("Hello, World!")
165165
folders:
166166
- .devops/modules/mod1:
167-
struct: terraform-module
167+
struct: terraform/module
168168
- .devops/modules/mod2:
169-
struct: terraform-module
169+
struct: terraform/module
170170
with:
171171
module_name: mymod2
172172
- ./:
173173
struct:
174174
- docker-files
175-
- go-project
175+
- project/go
176176
variables:
177177
- project_name:
178178
description: "The name of the project"
@@ -267,9 +267,9 @@ Example:
267267
```yaml
268268
folders:
269269
- .devops/modules/mod1:
270-
struct: terraform-module
270+
struct: terraform/module
271271
- .devops/modules/mod2:
272-
struct: terraform-module
272+
struct: terraform/module
273273
with:
274274
module_name: mymod2
275275
```

example/structure.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ structure:
2424
run: echo Hello, world!
2525
folders:
2626
- .devops/modules/mod1:
27-
struct: terraform-module
27+
struct: terraform/module
2828
- .devops/modules/mod2:
29-
struct: terraform-module
29+
struct: terraform/module
3030
with:
3131
module_name: mymod2
3232
- ./:
3333
struct:
3434
- docker-files
35-
- go-project
35+
- project/go
3636
- github/workflows/pre-commit
3737
variables:
3838
- project_name:

struct_module/commands/validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def execute(self, args):
3030
# Example:
3131
# folders:
3232
# - .devops/modules/my_module_one:
33-
# struct: terraform-module
33+
# struct: terraform/module
3434
# - .devops/modules/my_module_two:
35-
# struct: terraform-module
35+
# struct: terraform/module
3636
# with:
3737
# module_name: my_module_two
3838
def _validate_folders_config(self, folders):

struct_module/contribs/generic-app.yaml

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -172,50 +172,6 @@ structure:
172172
173173
# Canonical name and email address for the app owner
174174
# app-owner <
175-
- .pre-commit-config.yaml:
176-
content: |
177-
repos:
178-
- repo: https://github.com/pre-commit/pre-commit-hooks
179-
rev: v4.6.0
180-
hooks:
181-
- id: trailing-whitespace
182-
- id: end-of-file-fixer
183-
- id: check-yaml
184-
- .tf/states/environments/dev/main.tf:
185-
content: "# Terraform configuration for the dev environment"
186-
- .tf/states/environments/dev/providers.tf:
187-
content: |
188-
provider "aws" {
189-
region = "${ aws_region }"
190-
}
191-
- .tf/states/environments/prod/main.tf:
192-
content: "# Terraform configuration for the prod environment"
193-
- .tf/states/environments/prod/providers.tf:
194-
content: |
195-
provider "aws" {
196-
region = "${ aws_region }"
197-
}
198-
- .tf/states/environments/qa/main.tf:
199-
content: "# Terraform configuration for the qa environment"
200-
- .tf/states/environments/qa/providers.tf:
201-
content: |
202-
provider "aws" {
203-
region = "${ aws_region }"
204-
}
205-
- .tf/states/environments/stage/main.tf:
206-
content: "# Terraform configuration for the stage environment"
207-
- .tf/states/environments/stage/providers.tf:
208-
content: |
209-
provider "aws" {
210-
region = "${ aws_region }"
211-
}
212-
- .tf/states/init/main.tf:
213-
content: "# Terraform configuration for the init environment"
214-
- .tf/states/init/providers.tf:
215-
content: |
216-
provider "aws" {
217-
region = "${ aws_region }"
218-
}
219175
- ACKNOWLEDGEMENTS.md:
220176
content: |
221177
# Acknowledgements
@@ -335,3 +291,19 @@ structure:
335291
# tools Folder
336292
337293
Convenience directory for your use. Should contain scripts to automate tasks in the project, for example, build scripts, rename scripts. Usually contains .sh, .cmd files for example.
294+
295+
folders:
296+
- .devops/apps/environments/prod:
297+
struct: terraform/module
298+
- .devops/apps/environments/stage:
299+
struct: terraform/module
300+
- .devops/apps/environments/qa:
301+
struct: terraform/module
302+
- .devops/apps/environments/dev:
303+
struct: terraform/module
304+
- .devops/apps/init:
305+
struct: terraform/module
306+
- ./:
307+
struct:
308+
- github/workflows/pre-commit
309+
- github/workflows/release-drafter

struct_module/contribs/github-workflows.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
folders:
2+
- ./:
3+
struct:
4+
- github/workflows/pre-commit
5+
- github/workflows/release-drafter
6+
- github/workflows/terraform-workflow
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
structure:
2+
- .github/workflows/release-drafter.yaml:
3+
content: |
4+
name: Release Drafter
5+
6+
on:
7+
push:
8+
branches:
9+
- {{@ current_repo() | default_branch @}}
10+
11+
jobs:
12+
update_release_draft:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@{{@ "actions/checkout" | latest_release @}}
20+
with:
21+
fetch-depth: 0
22+
- uses: release-drafter/release-drafter@{{@ "release-drafter/release-drafter" | latest_release @}}
23+
id: release-drafter
24+
with:
25+
config-name: release-drafter.yml
26+
publish: false
27+
prerelease: false
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
- name: version
31+
id: version
32+
run: |
33+
git pull --tags
34+
echo ${{ steps.release-drafter.outputs.tag_name }}
35+
tag=${{ steps.release-drafter.outputs.tag_name }}
36+
version=${tag#v}
37+
major=${version%%.*}
38+
echo "tag=${tag}" >> $GITHUB_OUTPUT
39+
echo "version=${version}" >> $GITHUB_OUTPUT
40+
echo "major=${major}" >> $GITHUB_OUTPUT
41+
42+
- name: force update major tag
43+
run: |
44+
git tag v${{ steps.version.outputs.major }} ${{ steps.version.outputs.tag }} -f
45+
git push origin refs/tags/v${{ steps.version.outputs.major }} -f
46+
- .github/release-drafter.yml:
47+
content: |
48+
name-template: "v$RESOLVED_VERSION 🌈"
49+
tag-template: "v$RESOLVED_VERSION"
50+
categories:
51+
- title: "🚀 Features"
52+
labels:
53+
- "feature"
54+
- "enhancement"
55+
- title: "🐛 Bug Fixes"
56+
labels:
57+
- "fix"
58+
- "bugfix"
59+
- "bug"
60+
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
61+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
62+
version-template: "$MAJOR.$MINOR.$PATCH"
63+
version-resolver:
64+
major:
65+
labels:
66+
- "major"
67+
minor:
68+
labels:
69+
- "minor"
70+
patch:
71+
labels:
72+
- "patch"
73+
default: patch
74+
template: |
75+
## Changes
76+
$CHANGES
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
structure:
2+
- .github/workflows/terrform-workflow.yaml:
3+
file: https://raw.githubusercontent.com/httpdss/github-workflows/main/.github/workflows/terraform-workflow.yaml

0 commit comments

Comments
 (0)