-
Notifications
You must be signed in to change notification settings - Fork 0
Simplify fork maintenance and add installation scripts #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
e3e111b
604f4a9
856897e
5e37ce4
0eede87
ec1e1ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| # Copilot Instructions for OpenTofu ORAS Fork | ||
|
|
||
| ## Project Overview | ||
|
|
||
| This is a **fork** of [opentofu/opentofu](https://github.com/opentofu/opentofu) that adds an **ORAS backend** for storing OpenTofu state in OCI registries (Docker, GHCR, ECR, etc.). | ||
|
|
||
| ## Branch Strategy | ||
|
|
||
| ``` | ||
| main → Synchronized with opentofu/opentofu:main (tracking only, do not commit here) | ||
| develop → Main development branch (all PRs target here) | ||
| ``` | ||
|
|
||
| ### Branch Rules | ||
|
|
||
| | Branch | Purpose | Commits | | ||
| |--------|---------|---------| | ||
| | `main` | Tracks upstream opentofu/opentofu | Only via sync-upstream workflow | | ||
| | `develop` | All fork development | Via Pull Requests | | ||
|
|
||
| ### Workflow | ||
|
|
||
| 1. **Sync upstream**: `sync-upstream.yml` runs daily and when new upstream tags are detected | ||
| 2. **PR to develop**: Creates PR `🚀 Release vX.Y.Z` from `main` → `develop` | ||
| 3. **Review & merge**: Manually merge the PR (resolve conflicts if any) | ||
| 4. **Auto-release**: `auto-release.yml` creates tag `vX.Y.Z-oci` and GitHub Release | ||
| 5. **Build**: `release-fork.yml` builds binaries for all platforms | ||
|
|
||
| ## Release Naming Convention | ||
|
|
||
| Fork releases follow upstream versions with `-oci` suffix: | ||
|
|
||
| - Upstream: `v1.12.0` | ||
| - Fork: `v1.12.0-oci` | ||
|
|
||
| This allows users to choose which upstream version they want with ORAS support. | ||
|
|
||
| ## Key Directories | ||
|
|
||
| ### ORAS Backend (main contribution) | ||
|
|
||
| ``` | ||
| internal/backend/remote-state/oras/ | ||
| ├── backend.go # Backend implementation | ||
| ├── client.go # OCI registry client | ||
| ├── state.go # State management | ||
| ├── locking.go # Distributed locking | ||
| ├── versioning.go # State versioning | ||
| ├── README.md # Detailed documentation | ||
| └── *_test.go # Tests | ||
| ``` | ||
|
|
||
| ### Fork-specific files (not in upstream) | ||
|
|
||
| ``` | ||
| .github/ | ||
| ├── copilot-instructions.md # This file | ||
| ├── release.yml # Release notes configuration | ||
| ├── labeler.yml # PR auto-labeling rules | ||
| └── workflows/ | ||
| ├── release-fork.yml # Fork release workflow | ||
| ├── sync-upstream.yml # Upstream sync automation | ||
| ├── auto-release.yml # Auto-tagging on merge | ||
| └── labeler.yml # PR labeler workflow | ||
| ``` | ||
|
|
||
| ## Development Guidelines | ||
|
|
||
| ### Creating PRs | ||
|
|
||
| 1. Always target `develop` branch | ||
| 2. Use descriptive titles for release notes generation | ||
| 3. Apply appropriate labels (auto-labeler will help): | ||
| - `oras`, `oci`, `backend` - ORAS backend changes | ||
| - `enhancement`, `feature` - New features | ||
| - `bug`, `fix` - Bug fixes | ||
| - `documentation` - Docs changes | ||
| - `ci` - CI/CD changes | ||
|
|
||
| ### Commit Messages | ||
|
|
||
| No strict format required, but be descriptive. Examples: | ||
| - `Add compression support to ORAS backend` | ||
| - `Fix lock acquisition race condition` | ||
| - `Update CI workflows for develop branch` | ||
|
|
||
| ### Testing | ||
|
|
||
| ```bash | ||
| # Run ORAS backend tests | ||
| go test ./internal/backend/remote-state/oras/... | ||
|
|
||
| # Run all tests | ||
| go test ./... | ||
| ``` | ||
|
|
||
| ## Files to NEVER modify on develop | ||
|
|
||
| These files should only change via upstream sync: | ||
|
|
||
| - `LICENSE` | ||
| - `CHARTER.md` | ||
| - `GOVERNANCE.md` | ||
| - Core OpenTofu code (unless fixing integration with ORAS) | ||
|
|
||
| ## Labels for Release Notes | ||
|
|
||
| PRs are automatically categorized in releases based on labels: | ||
|
|
||
| | Label | Category | | ||
| |-------|----------| | ||
| | `enhancement`, `feature` | 🚀 Features | | ||
| | `bug`, `fix` | 🐛 Bug Fixes | | ||
| | `oras`, `oci`, `backend` | 📦 ORAS Backend | | ||
| | `security` | 🔒 Security | | ||
| | `documentation` | 📚 Documentation | | ||
| | `test` | 🧪 Tests | | ||
| | `maintenance`, `chore` | 🔧 Maintenance | |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,121 @@ | ||||||||||||||
| name: Auto Release | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| pull_request: | ||||||||||||||
| types: [closed] | ||||||||||||||
| branches: | ||||||||||||||
| - develop | ||||||||||||||
|
|
||||||||||||||
| permissions: | ||||||||||||||
| contents: write | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| create-release: | ||||||||||||||
| name: Create release on merge | ||||||||||||||
| if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, '🚀 Release v') | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
| steps: | ||||||||||||||
| - name: Checkout repository | ||||||||||||||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||||||||||||||
| with: | ||||||||||||||
| fetch-depth: 0 | ||||||||||||||
| ref: develop | ||||||||||||||
|
|
||||||||||||||
| - name: Extract version from PR title | ||||||||||||||
| id: version | ||||||||||||||
| run: | | ||||||||||||||
| # Extract version from PR title "🚀 Release v1.2.3" | ||||||||||||||
| PR_TITLE="${{ github.event.pull_request.title }}" | ||||||||||||||
| VERSION=$(echo "$PR_TITLE" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+') | ||||||||||||||
|
Comment on lines
+27
to
+29
|
||||||||||||||
| # Extract version from PR title "🚀 Release v1.2.3" | |
| PR_TITLE="${{ github.event.pull_request.title }}" | |
| VERSION=$(echo "$PR_TITLE" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+') | |
| # Extract version from PR title like "🚀 Release v1.2.3" or "🚀 Release v1.2.3-alpha+build.1" | |
| PR_TITLE="${{ github.event.pull_request.title }}" | |
| VERSION=$(echo "$PR_TITLE" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?') |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ on: | |
| push: | ||
| branches: | ||
| - main | ||
| - develop | ||
| - 'v[0-9]+.[0-9]+' | ||
| tags: | ||
| - 'v[0-9]+.[0-9]+.[0-9]+*' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ on: | |
| push: | ||
| branches: | ||
| - main | ||
| - develop | ||
| - 'v[0-9]+.[0-9]+' | ||
| - checks-workflow-dev/* | ||
| tags: | ||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow lacks concurrency control, which could lead to issues if multiple release PRs are merged simultaneously or in quick succession. Multiple concurrent runs could create duplicate tags or conflicting releases. Consider adding a concurrency group to ensure only one auto-release operation runs at a time.