fix(ci): Reuse existing PR instead of bumping version on re-runs#715
Merged
Conversation
- Add Subcategory field to TerraformProviderConfig struct for YAML override support - Add Subcategory field to TerraformProviderSpecMetadata struct - Implement deriveSubcategoryFromPath() to extract subcategory from spec directory - Generate individual tfplugindocs templates per resource/data source with subcategory - Pass subcategory through to terraform provider metadata Subcategory derivation from directory structure: - specs/network/ → "Network" - specs/objects/ → "Objects" - specs/device/ → "Device" - specs/panorama/ → "Panorama" - specs/policies/ → "Policies" The generated templates in target/terraform/templates/ will have the subcategory hardcoded, eliminating the need for fix-docs.go post-processing script.
Add scripts/release.sh to automate the PAN-OS release process with three modes: - --auto: Fully automated (runs codegen, versions, tags, pushes) - --manual: Interactive (prompts for confirmation, no auto-push) - --dry-run: Simulation (shows what would be done) The script handles: - Running codegen in pan-os-codegen - Copying generated code to pango and terraform-provider-panos - Version determination using standard-version (with fallback) - Creating commits and tags - Running gofix and terraform doc generation - Validating subcategories in documentation - Pushing to remote (in auto mode only) Uses npx standard-version for conventional commit-based versioning, with fallback to manual detection if standard-version is unavailable. Includes comprehensive logging with timestamps and colored output.
- Fix Makefile to use correct config path (cmd/codegen/config.yaml) - Accumulate flags when same resource has both resource and datasource - Add debug logging for template generation This ensures tfplugindocs templates are generated correctly with proper subcategories for all resources and data sources.
terraform-plugin-docs automatically prepends the provider name when looking up templates. Template files should be named without the provider prefix: - Before: panos_address.md.tmpl (looked for panos_panos_address) - After: address.md.tmpl (correctly looks for panos_address) This fixes the 'does not exist' error when generating terraform docs.
Resolved conflicts in pkg/translate/terraform_provider/entity_generators.go by merging the subcategory support from the PR branch with the refactored code structure from main. The generator.go file was removed as it contained duplicate declarations now present in entity_generators.go. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add sensitive: true to API key in terraform provider config and to private-key field in certificate-import spec to ensure these values are handled securely in generated Terraform code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- release.yml: GitHub Actions workflow that generates code, runs tests, pushes pango SDK, and creates a provider PR with release notes - determine-version.sh: Detects next version from conventional commits with custom release rules (breaking=minor, feat=patch) - generate-release-notes.sh: Generates markdown release notes grouped by commit type Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…gory Specs can now set `skip_subcategory: true` to explicitly opt out of subcategory validation. This produces docs with an empty subcategory and records the resource in a .subcategory-skip file that CI uses to exclude them from validation. Missing subcategory without the flag is now an error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # pkg/commands/codegen/codegen.go # pkg/properties/normalized.go
The ethernet interface resources referenced panos_template.template but the template resource is named "tmpl". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The generated go.mod contains a replace directive pointing to ../pango for local development. In CI this path doesn't exist, so we need to drop it before fetching pango@main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ctive The generated go.mod has a local replace directive for pango that doesn't exist in CI. Instead of trying to drop it, exclude go.mod and go.sum from rsync entirely — the provider repo has its own, and go get/go mod tidy will reconcile dependencies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The go generate step in the provider PR job requires the terraform binary to generate plugin documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The generated go.mod includes tool dependencies (tfplugindocs) that the provider needs. Include it in rsync but strip the local replace directive (../pango) with sed before running go get. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
go mod tidy removes the tool dependency; explicitly fetch it before running go generate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
go mod tidy removes tool-only dependencies. Use go install to put the binary on PATH instead, so go generate can find it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
go generate uses go run for tfplugindocs which requires the module in go.mod. go mod tidy removes tool-only deps, so it must run after generate, not before. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The generated go.mod doesn't include terraform-plugin-docs (it's only in go:generate directives). Explicitly go get it before running go generate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When an unmerged auto-release PR exists, the workflow now reuses its version and force-pushes updated code to the same branch instead of creating a duplicate PR with a new version. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflicts in .github/workflows/release.yml, keeping the existing-PR-reuse logic, Terraform setup step, tfplugindocs dependency, and named flags for release notes generation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…wire example Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate)
Types of changes
Checklist