Skip to content

fix(ci): Reuse existing PR instead of bumping version on re-runs#715

Merged
migara merged 23 commits into
mainfrom
sensitive-vars
Apr 8, 2026
Merged

fix(ci): Reuse existing PR instead of bumping version on re-runs#715
migara merged 23 commits into
mainfrom
sensitive-vars

Conversation

@migara
Copy link
Copy Markdown
Member

@migara migara commented Apr 8, 2026

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

migara and others added 21 commits February 12, 2026 14:49
- 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>
@migara migara changed the title Sensitive vars fix(ci): Reuse existing PR instead of bumping version on re-runs Apr 8, 2026
migara and others added 2 commits April 8, 2026 23:17
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>
@migara migara merged commit 175dd96 into main Apr 8, 2026
3 checks passed
@migara migara deleted the sensitive-vars branch April 8, 2026 22:26
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.

1 participant