Skip to content

Conversation

@gberenice
Copy link
Member

@gberenice gberenice commented Apr 27, 2025

what

  • This PR introduces a new task for synchronizing common files and directories across our TF OS module repositories from a central template repository.

  • Added os:sync task for automated synchronization of common files.

  • Added os:pull-and-branch task to pull the latest default branch and create a branch from it.

  • Added the os:sync-all task, which combines all of the above.

  • Added the os:push task, which pushes changes to the remote repo. It wasn't added to os:sync-all intentionally to avoid undesired changes.

  • Supports syncing to both default and custom module repositories

  • Implements rsync with archive mode for preserving file attributes.

  • Files Synchronized

    • .github/ (directory)
    • .trunk/ (directory)
    • .coderabbit.yaml
    • .editorconfig
    • .gitignore
    • .terraform-docs.yaml
    • LICENSE
    • aqua.yaml
  • Default Behavior

    task os:sync

    This syncs files to all default Terraform module repositories hardcoded in the taskfile.

  • Custom Repositories

    task os:sync -- terraform-custom-module
    # or multiple modules
    task os:sync -- "terraform-custom-module terraform-another-module"
  • Details:

    • Creates temporary directory (.tmp-template-sync) for template repository
    • Uses rsync with -a (archive), -v (verbose), and --delete options
    • Automatically cleans up temporary directory after sync
  • Important: Files in destination repositories that no longer exist in the template will be removed

why

  • We need some tooling around syncing our common files across the OS repos.

references

Summary by CodeRabbit

  • Chores
    • Updated versions of CLI, plugins, linters, and runtimes in configuration files for improved tooling and compatibility.
  • New Features
    • Introduced a new task for synchronizing files from a template repository to multiple Terraform module repositories, streamlining module maintenance.
  • Chores
    • Added an include entry to the task configuration for easier access to OS module tasks.
  • Chores
    • Added repository configuration for code ownership to clarify responsibility.
    • Added a pull request template to standardize contribution descriptions.
  • Documentation
    • Expanded and restructured the README with branding, contribution guidelines, organizational info, and community links.
    • Updated markdownlint configuration to relax certain style rules.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 27, 2025

Walkthrough

This update introduces a new task automation structure for managing Terraform open-source modules. The main addition is a Taskfile under lib/os-modules that defines a sync task to synchronize common files from a template repository into multiple module repositories using rsync. The root Taskfile is updated to include these OS module tasks. Separately, the .trunk/trunk.yaml configuration is updated to newer versions for the CLI, plugins, linters, and the Node.js runtime, with no changes to logic or enabled actions. Additionally, repository configuration files .github/CODEOWNERS and .github/PULL_REQUEST_TEMPLATE.md were added, and the README was significantly expanded with branding, contribution guidelines, and community information. The markdownlint config was also adjusted to relax some linting rules.

Changes

File(s) Change Summary
.trunk/trunk.yaml Updated versions for CLI (1.19.0 → 1.22.12), trunk plugin, linters (actionlint, checkov, trivy, yamllint, markdownlint, prettier, trufflehog), and Node.js runtime (18.12.1 → 18.20.5). No logic changes.
Taskfile.yaml Added os include mapping to lib/os-modules for task namespacing.
lib/os-modules/Taskfile.yaml New Taskfile defining sync task to automate syncing common files from a template repo to multiple Terraform module repos.
.github/CODEOWNERS Added CODEOWNERS file assigning @masterpointio/masterpoint-open-source team ownership of all files.
.github/PULL_REQUEST_TEMPLATE.md Added PR template with sections for "what," "why," and "references" to standardize PR descriptions.
.trunk/configs/.markdownlint.yaml Disabled MD041 rule (first line heading), relaxed MD013 line length rule (set strict false, line length 350).
README.md Expanded with banner, badges, new sections for purpose, contributors, contribution guidelines, organization info, social links, and license details.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Taskfile (root)
    participant OS Modules Taskfile
    participant GitHub (template repo)
    participant Module Repo

    User->>Taskfile (root): Run os:sync [MODULES]
    Taskfile (root)->>OS Modules Taskfile: Delegate sync task
    OS Modules Taskfile->>GitHub (template repo): Clone template repo
    loop For each module
        loop For each file/directory
            OS Modules Taskfile->>Module Repo: rsync file/dir from template
        end
    end
    OS Modules Taskfile->>OS Modules Taskfile: Remove temp directory
    OS Modules Taskfile->>User: Sync complete
Loading

Possibly related PRs

Poem

In the land of modules, tasks now align,
With syncing made simple, efficiency shines.
Versions march forward, linters refreshed,
Common files travel, repositories enmeshed.
A click, a command—let automation sing,
For Terraform modules, let harmony spring!
🚀✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e1a9f6 and 502f64c.

📒 Files selected for processing (5)
  • .github/CODEOWNERS (1 hunks)
  • .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
  • .trunk/configs/.markdownlint.yaml (1 hunks)
  • README.md (2 hunks)
  • lib/os-modules/Taskfile.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • .trunk/configs/.markdownlint.yaml
  • .github/CODEOWNERS
  • .github/PULL_REQUEST_TEMPLATE.md
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/os-modules/Taskfile.yaml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
lib/os-modules/Taskfile.yaml (3)

17-29: Consider refactoring DEFAULT_MODULES to a YAML sequence
Defining modules as a list improves readability and reduces backslash-based line-continuation complexity. You could use:

vars:
  DEFAULT_MODULES:
    - terraform-aws-ssm-agent
    - terraform-aws-tailscale
    
  MODULES: "{{if .CLI_ARGS}}{{.CLI_ARGS}}{{else}}{{join .DEFAULT_MODULES \" \"}}{{end}}"

30-39: Use YAML sequence for FILES list
Listing files as a sequence and iterating with {{range .FILES}} makes the config clearer than a multi-line scalar.


40-52: Enhance script robustness with error handling and temp dir management
Add set -euo pipefail and use mktemp -d with a trap to ensure clean up on errors, for example:

set -euo pipefail
TMP_DIR=$(mktemp -d)
trap 'rm -rf "$TMP_DIR"' EXIT
git clone --depth 1 https://github.com/... "$TMP_DIR"
Taskfile.yaml (1)

8-8: Register OS modules include alias
The os: lib/os-modules include correctly integrates the new sync tasks. Consider updating the project’s documentation to cover the os:sync invocation.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f7e1da and 8e1a9f6.

📒 Files selected for processing (3)
  • .trunk/trunk.yaml (1 hunks)
  • Taskfile.yaml (1 hunks)
  • lib/os-modules/Taskfile.yaml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.yaml`: You are well-versed in writing and reviewing YAML configurations for the Task tool (https://taskfile.dev/). Provide recommendations for clarity, maintainability, and a...

**/*.yaml: You are well-versed in writing and reviewing YAML configurations for the Task tool (https://taskfile.dev/).
Provide recommendations for clarity, maintainability, and adherence to Taskfile best practices, including usage of variables, environment blocks, and includes.
These configurations may also contain embedded Bash scripts or commands.
Demonstrate bash scripting best practices such as error handling, secure variable expansions, and clear documentation.

  • Taskfile.yaml
  • lib/os-modules/Taskfile.yaml
🔇 Additional comments (5)
.trunk/trunk.yaml (4)

3-3: CLI version bump
Upgraded the Trunk CLI to 1.22.12. Please verify compatibility by running local checks (e.g., trunk version and trunk check --local).


7-7: Plugin source version update
Updated the Trunk plugin ref to v1.6.8. Ensure any plugin-driven workflows continue to function as expected.


11-14: Linter version bump approvals
Linter versions for actionlint, checkov, trivy, yamllint, markdownlint, prettier, and trufflehog have been updated. Run trunk lint --local to confirm there are no new lint failures or config conflicts.

Also applies to: 16-18


21-21: Node runtime version update
Bumped Node runtime to 18.20.5. Verify all Node-based tasks and scripts execute correctly under this new version.

lib/os-modules/Taskfile.yaml (1)

1-1: Confirm Taskfile version consistency
This Taskfile uses version "3". Ensure it matches the root Taskfile version to avoid include mismatches.

@gberenice gberenice requested a review from a team April 28, 2025 14:03
@gberenice gberenice force-pushed the feature/int-71/add-modules-tasks branch from 502f64c to 990d250 Compare April 28, 2025 14:06
Copy link
Contributor

@oycyc oycyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome and convenient!

Copy link
Member

@Gowiem Gowiem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: I like it -- this a great start to more easily maintaining these repos 🙌

cc @westonplatter so he's aware of this 👍

@gberenice gberenice merged commit d52cc04 into main Apr 28, 2025
2 checks passed
@gberenice gberenice deleted the feature/int-71/add-modules-tasks branch April 28, 2025 19:44
gberenice pushed a commit that referenced this pull request Apr 28, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.3.0](v0.2.0...v0.3.0)
(2025-04-28)


### Features

* **os-modules:** add tasks lib for OS modules management
([#15](#15))
([d52cc04](d52cc04))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
gberenice added a commit to masterpointio/terraform-spacelift-policies that referenced this pull request Apr 28, 2025
## what

- This updates the module with configs from the template module.
- Made entirely with taskit (except of REAME), see
masterpointio/taskit#15

## why

- Keep standard configs in order.

## references

-
[INT-26](https://www.notion.so/masterpoint/Sync-repo-with-our-standard-files-149859758a568022871feb164c434990?pvs=4)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced automated dependency update management and documentation
generation workflows.
- Added a new workflow to run Terraform tests automatically on pushes
and pull requests.

- **Bug Fixes**
- Improved .gitignore rules to better manage Terraform lock files in
examples.

- **Chores**
	- Updated code ownership to the open-source team.
- Upgraded versions of tools, linters, and plugins for better
reliability and security.
- Enhanced and clarified configuration files for review automation,
markdown linting, and tool management.

- **Documentation**
- Expanded and improved the README with branding, contribution
guidelines, and license details.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants