Skip to content

Commit 74c8437

Browse files
committed
refactor: rename runner to tfroot-runner, centralize pre-commit config
- Rename runner/ to tfroot-runner/ - Update pre-commit-config.yaml with full hook set from tfroot repos - Add conventional-pre-commit, end-of-file-fixer hooks - Add -backend=false to terraform_validate for all repos - Add AGENTS.md with instructions for maintaining pre-commit config - Update README.md with new image name and pre-commit documentation
1 parent 9ebdedc commit 74c8437

5 files changed

Lines changed: 85 additions & 29 deletions

File tree

AGENTS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Agent Instructions
2+
3+
## Repository Purpose
4+
5+
This is a container image monorepo. Each subdirectory with a `Containerfile` becomes a container image published to `ghcr.io/makeitworkcloud/<dir>:latest`.
6+
7+
## Push Access
8+
9+
Agents are authorized to push directly to `main` in this repository.
10+
11+
## Key Files
12+
13+
### tfroot-runner/pre-commit-config.yaml
14+
15+
This is the **canonical pre-commit configuration** for all `tfroot-*` repositories in the organization. When modifying pre-commit hooks:
16+
17+
1. Edit `tfroot-runner/pre-commit-config.yaml` in this repo
18+
2. The shared-workflows OpenTofu workflow fetches this config at CI time
19+
3. The tfroot-runner image pre-caches these hooks for faster CI runs
20+
21+
**Do not** modify `.pre-commit-config.yaml` files in individual `tfroot-*` repos - they source from here.
22+
23+
## Related Repositories
24+
25+
- `shared-workflows` - Contains reusable GitHub Actions workflows that reference the tfroot-runner image
26+
- `tfroot-cloudflare`, `tfroot-libvirt`, `tfroot-github`, `tfroot-aws` - Terraform root module repos that use the tfroot-runner image via shared-workflows

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,14 @@ Container image monorepo. Each subdirectory with a `Containerfile` is built and
2626

2727
| Directory | Description |
2828
|-----------|-------------|
29-
| `runner/` | Alpine-based IaC runner with OpenTofu, Checkov, pre-commit, SOPS, tflint, terraform-docs |
29+
| `tfroot-runner/` | Alpine-based IaC runner with OpenTofu, Checkov, pre-commit, SOPS, tflint, terraform-docs. Used by all `tfroot-*` repos. |
30+
| `gh-cli/` | GitHub CLI image |
31+
32+
## Pre-commit Configuration
33+
34+
The `tfroot-runner/pre-commit-config.yaml` file is the **canonical pre-commit configuration** for all `tfroot-*` repositories. This config is:
35+
36+
1. Bundled into the container image to pre-cache hook environments
37+
2. Fetched at CI time by the shared OpenTofu workflow
38+
39+
To update pre-commit hooks for all tfroot repos, modify `tfroot-runner/pre-commit-config.yaml` and push to main.

runner/pre-commit-config.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Canonical pre-commit configuration for tfroot-* repositories.
2+
# This file is bundled into the tfroot-runner container image to pre-cache hooks.
3+
# It is also fetched by the shared OpenTofu workflow at CI time.
4+
#
5+
# To update hooks for all tfroot repos, modify this file and rebuild the image.
6+
repos:
7+
- repo: https://github.com/compilerla/conventional-pre-commit
8+
rev: v4.0.0
9+
hooks:
10+
- id: conventional-pre-commit
11+
stages: [commit-msg]
12+
- repo: https://github.com/antonbabenko/pre-commit-terraform
13+
rev: v1.104.0
14+
hooks:
15+
- id: terraform_validate
16+
args:
17+
- --hook-config=--retry-once-with-cleanup=true
18+
- --args=-no-color
19+
- --tf-init-args=-reconfigure
20+
- --tf-init-args=-upgrade
21+
- --tf-init-args=-backend=false
22+
- id: terraform_tflint
23+
args:
24+
- --args=--minimum-failure-severity=error
25+
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
26+
- id: terraform_checkov
27+
args:
28+
- --args=--config-file __GIT_WORKING_DIR__/.checkov.yml
29+
- id: terraform_fmt
30+
args:
31+
- --args=-no-color
32+
- --args=-diff
33+
- --args=-recursive
34+
- id: terraform_docs
35+
args:
36+
- --args=--config=.terraform-docs.yml
37+
- repo: https://github.com/pre-commit/pre-commit-hooks
38+
rev: v6.0.0
39+
hooks:
40+
- id: check-case-conflict
41+
- id: check-merge-conflict
42+
- id: check-symlinks
43+
- id: check-vcs-permalinks
44+
- id: destroyed-symlinks
45+
- id: detect-private-key
46+
- id: end-of-file-fixer
47+
- id: mixed-line-ending
48+
- id: trailing-whitespace

0 commit comments

Comments
 (0)