From 33c145a833746add38c7683969498cc187ba74f1 Mon Sep 17 00:00:00 2001 From: Kenneth Belitzky Date: Mon, 16 Dec 2024 20:57:15 -0300 Subject: [PATCH] Refactor folder structure references from 'terraform-module' to 'terraform/module' and update related documentation --- README.es.md | 8 +- README.md | 8 +- example/structure.yaml | 4 +- struct_module/commands/validate.py | 4 +- struct_module/contribs/generic-app.yaml | 60 ++++----------- struct_module/contribs/github-workflows.yaml | 11 --- .../github/workflows/all-workflows.yaml | 6 ++ .../github/workflows/release-drafter.yaml | 76 +++++++++++++++++++ .../github/workflows/terraform-workflow.yaml | 3 + .../{go-project.yaml => project/go.yaml} | 0 .../{java-project.yaml => project/java.yaml} | 0 .../nodejs.yaml} | 0 .../python.yaml} | 0 .../{ruby-project.yaml => project/ruby.yaml} | 0 .../{rust-project.yaml => project/rust.yaml} | 0 .../{ => terraform}/terraform-app.yaml | 0 .../{ => terraform}/terraform-module.yaml | 0 17 files changed, 113 insertions(+), 67 deletions(-) delete mode 100644 struct_module/contribs/github-workflows.yaml create mode 100644 struct_module/contribs/github/workflows/all-workflows.yaml create mode 100644 struct_module/contribs/github/workflows/release-drafter.yaml create mode 100644 struct_module/contribs/github/workflows/terraform-workflow.yaml rename struct_module/contribs/{go-project.yaml => project/go.yaml} (100%) rename struct_module/contribs/{java-project.yaml => project/java.yaml} (100%) rename struct_module/contribs/{nodejs-project.yaml => project/nodejs.yaml} (100%) rename struct_module/contribs/{python-project.yaml => project/python.yaml} (100%) rename struct_module/contribs/{ruby-project.yaml => project/ruby.yaml} (100%) rename struct_module/contribs/{rust-project.yaml => project/rust.yaml} (100%) rename struct_module/contribs/{ => terraform}/terraform-app.yaml (100%) rename struct_module/contribs/{ => terraform}/terraform-module.yaml (100%) diff --git a/README.es.md b/README.es.md index cc50eb0..d8508df 100644 --- a/README.es.md +++ b/README.es.md @@ -166,9 +166,9 @@ structure: print("Hello, World!") folders: - .devops/modules/mod1: - struct: terraform-module + struct: terraform/module - .devops/modules/mod2: - struct: terraform-module + struct: terraform/module with: module_name: mymod2 - ./: @@ -269,9 +269,9 @@ Ejemplo: ```yaml folders: - .devops/modules/mod1: - struct: terraform-module + struct: terraform/module - .devops/modules/mod2: - struct: terraform-module + struct: terraform/module with: module_name: mymod2 ``` diff --git a/README.md b/README.md index 6d29ec8..2c60342 100644 --- a/README.md +++ b/README.md @@ -164,9 +164,9 @@ structure: print("Hello, World!") folders: - .devops/modules/mod1: - struct: terraform-module + struct: terraform/module - .devops/modules/mod2: - struct: terraform-module + struct: terraform/module with: module_name: mymod2 - ./: @@ -267,9 +267,9 @@ Example: ```yaml folders: - .devops/modules/mod1: - struct: terraform-module + struct: terraform/module - .devops/modules/mod2: - struct: terraform-module + struct: terraform/module with: module_name: mymod2 ``` diff --git a/example/structure.yaml b/example/structure.yaml index 78233e1..5859205 100644 --- a/example/structure.yaml +++ b/example/structure.yaml @@ -24,9 +24,9 @@ structure: run: echo Hello, world! folders: - .devops/modules/mod1: - struct: terraform-module + struct: terraform/module - .devops/modules/mod2: - struct: terraform-module + struct: terraform/module with: module_name: mymod2 - ./: diff --git a/struct_module/commands/validate.py b/struct_module/commands/validate.py index e5058e4..79862a4 100644 --- a/struct_module/commands/validate.py +++ b/struct_module/commands/validate.py @@ -30,9 +30,9 @@ def execute(self, args): # Example: # folders: # - .devops/modules/my_module_one: - # struct: terraform-module + # struct: terraform/module # - .devops/modules/my_module_two: - # struct: terraform-module + # struct: terraform/module # with: # module_name: my_module_two def _validate_folders_config(self, folders): diff --git a/struct_module/contribs/generic-app.yaml b/struct_module/contribs/generic-app.yaml index 2d336d6..909531c 100644 --- a/struct_module/contribs/generic-app.yaml +++ b/struct_module/contribs/generic-app.yaml @@ -172,50 +172,6 @@ structure: # Canonical name and email address for the app owner # app-owner < - - .pre-commit-config.yaml: - content: | - repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - .tf/states/environments/dev/main.tf: - content: "# Terraform configuration for the dev environment" - - .tf/states/environments/dev/providers.tf: - content: | - provider "aws" { - region = "${ aws_region }" - } - - .tf/states/environments/prod/main.tf: - content: "# Terraform configuration for the prod environment" - - .tf/states/environments/prod/providers.tf: - content: | - provider "aws" { - region = "${ aws_region }" - } - - .tf/states/environments/qa/main.tf: - content: "# Terraform configuration for the qa environment" - - .tf/states/environments/qa/providers.tf: - content: | - provider "aws" { - region = "${ aws_region }" - } - - .tf/states/environments/stage/main.tf: - content: "# Terraform configuration for the stage environment" - - .tf/states/environments/stage/providers.tf: - content: | - provider "aws" { - region = "${ aws_region }" - } - - .tf/states/init/main.tf: - content: "# Terraform configuration for the init environment" - - .tf/states/init/providers.tf: - content: | - provider "aws" { - region = "${ aws_region }" - } - ACKNOWLEDGEMENTS.md: content: | # Acknowledgements @@ -335,3 +291,19 @@ structure: # tools Folder 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. + +folders: + - .devops/apps/environments/prod: + struct: terraform/module + - .devops/apps/environments/stage: + struct: terraform/module + - .devops/apps/environments/qa: + struct: terraform/module + - .devops/apps/environments/dev: + struct: terraform/module + - .devops/apps/init: + struct: terraform/module + - ./: + struct: + - github/workflows/pre-commit + - github/workflows/release-drafter diff --git a/struct_module/contribs/github-workflows.yaml b/struct_module/contribs/github-workflows.yaml deleted file mode 100644 index 1f2ae77..0000000 --- a/struct_module/contribs/github-workflows.yaml +++ /dev/null @@ -1,11 +0,0 @@ -structure: - - .github/workflows/terrform-workflow.yaml: - file: https://raw.githubusercontent.com/httpdss/github-workflows/main/.github/workflows/terraform-workflow.yaml - - .github/workflows/pre-commit.yaml: - file: https://raw.githubusercontent.com/httpdss/struct/main/.github/workflows/pre-commit.yaml - - .github/workflows/release-drafter.yaml: - file: https://raw.githubusercontent.com/httpdss/github-workflows/main/.github/workflows/release-drafter.yaml - - .github/release-drafter.yml: - file: https://raw.githubusercontent.com/httpdss/github-workflows/main/.github/release-drafter.yml - - .pre-commit-config.yaml: - file: https://raw.githubusercontent.com/httpdss/struct/main/.pre-commit-config.yaml diff --git a/struct_module/contribs/github/workflows/all-workflows.yaml b/struct_module/contribs/github/workflows/all-workflows.yaml new file mode 100644 index 0000000..3042b16 --- /dev/null +++ b/struct_module/contribs/github/workflows/all-workflows.yaml @@ -0,0 +1,6 @@ +folders: + - ./: + struct: + - github/workflows/pre-commit + - github/workflows/release-drafter + - github/workflows/terraform-workflow diff --git a/struct_module/contribs/github/workflows/release-drafter.yaml b/struct_module/contribs/github/workflows/release-drafter.yaml new file mode 100644 index 0000000..39fd43d --- /dev/null +++ b/struct_module/contribs/github/workflows/release-drafter.yaml @@ -0,0 +1,76 @@ +structure: + - .github/workflows/release-drafter.yaml: + content: | + name: Release Drafter + + on: + push: + branches: + - {{@ current_repo() | default_branch @}} + + jobs: + update_release_draft: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@{{@ "actions/checkout" | latest_release @}} + with: + fetch-depth: 0 + - uses: release-drafter/release-drafter@{{@ "release-drafter/release-drafter" | latest_release @}} + id: release-drafter + with: + config-name: release-drafter.yml + publish: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: version + id: version + run: | + git pull --tags + echo ${{ steps.release-drafter.outputs.tag_name }} + tag=${{ steps.release-drafter.outputs.tag_name }} + version=${tag#v} + major=${version%%.*} + echo "tag=${tag}" >> $GITHUB_OUTPUT + echo "version=${version}" >> $GITHUB_OUTPUT + echo "major=${major}" >> $GITHUB_OUTPUT + + - name: force update major tag + run: | + git tag v${{ steps.version.outputs.major }} ${{ steps.version.outputs.tag }} -f + git push origin refs/tags/v${{ steps.version.outputs.major }} -f + - .github/release-drafter.yml: + content: | + name-template: "v$RESOLVED_VERSION 🌈" + tag-template: "v$RESOLVED_VERSION" + categories: + - title: "🚀 Features" + labels: + - "feature" + - "enhancement" + - title: "🐛 Bug Fixes" + labels: + - "fix" + - "bugfix" + - "bug" + change-template: "- $TITLE @$AUTHOR (#$NUMBER)" + change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. + version-template: "$MAJOR.$MINOR.$PATCH" + version-resolver: + major: + labels: + - "major" + minor: + labels: + - "minor" + patch: + labels: + - "patch" + default: patch + template: | + ## Changes + $CHANGES diff --git a/struct_module/contribs/github/workflows/terraform-workflow.yaml b/struct_module/contribs/github/workflows/terraform-workflow.yaml new file mode 100644 index 0000000..55deb23 --- /dev/null +++ b/struct_module/contribs/github/workflows/terraform-workflow.yaml @@ -0,0 +1,3 @@ +structure: + - .github/workflows/terrform-workflow.yaml: + file: https://raw.githubusercontent.com/httpdss/github-workflows/main/.github/workflows/terraform-workflow.yaml diff --git a/struct_module/contribs/go-project.yaml b/struct_module/contribs/project/go.yaml similarity index 100% rename from struct_module/contribs/go-project.yaml rename to struct_module/contribs/project/go.yaml diff --git a/struct_module/contribs/java-project.yaml b/struct_module/contribs/project/java.yaml similarity index 100% rename from struct_module/contribs/java-project.yaml rename to struct_module/contribs/project/java.yaml diff --git a/struct_module/contribs/nodejs-project.yaml b/struct_module/contribs/project/nodejs.yaml similarity index 100% rename from struct_module/contribs/nodejs-project.yaml rename to struct_module/contribs/project/nodejs.yaml diff --git a/struct_module/contribs/python-project.yaml b/struct_module/contribs/project/python.yaml similarity index 100% rename from struct_module/contribs/python-project.yaml rename to struct_module/contribs/project/python.yaml diff --git a/struct_module/contribs/ruby-project.yaml b/struct_module/contribs/project/ruby.yaml similarity index 100% rename from struct_module/contribs/ruby-project.yaml rename to struct_module/contribs/project/ruby.yaml diff --git a/struct_module/contribs/rust-project.yaml b/struct_module/contribs/project/rust.yaml similarity index 100% rename from struct_module/contribs/rust-project.yaml rename to struct_module/contribs/project/rust.yaml diff --git a/struct_module/contribs/terraform-app.yaml b/struct_module/contribs/terraform/terraform-app.yaml similarity index 100% rename from struct_module/contribs/terraform-app.yaml rename to struct_module/contribs/terraform/terraform-app.yaml diff --git a/struct_module/contribs/terraform-module.yaml b/struct_module/contribs/terraform/terraform-module.yaml similarity index 100% rename from struct_module/contribs/terraform-module.yaml rename to struct_module/contribs/terraform/terraform-module.yaml