Skip to content

Use release environment in release workflow#68

Open
oschwald wants to merge 6 commits into
mainfrom
greg/stf-42-release-workflow-environment
Open

Use release environment in release workflow#68
oschwald wants to merge 6 commits into
mainfrom
greg/stf-42-release-workflow-environment

Conversation

@oschwald

@oschwald oschwald commented Jul 3, 2026

Copy link
Copy Markdown
Member

Align the release workflow with mmdbinspect's structure.

  • Trigger on release: published instead of pushes of v* tags, and add workflow_dispatch, pull_request, and push-to-main triggers for CI.
  • Run the goreleaser job in the release deployment environment, so its deployment protection policy actually applies.
  • Scope contents: write to the job rather than the whole workflow.
  • Guard the job with if: github.event_name == 'release' && github.event.action == 'published' so it only runs for published releases.

Summary by CodeRabbit

  • Chores
    • Improved the release automation to run for manual runs, pull requests, main-branch updates, and published releases.
    • Added snapshot builds for non-release events to validate artifacts without publishing.
    • Publishing now triggers only for officially published releases, reducing the risk of unintended releases.
    • Tightened workflow permissions to use least-privilege access during release operations.
  • Improvements
    • Enhanced consistency in how output formats, compression options, and network column type hints are interpreted and validated.
  • Chores
    • Updated link checking to include URL fragments more completely.

@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@oschwald, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8fdf659c-ff50-44f9-94d3-66d7ce532539

📥 Commits

Reviewing files that changed from the base of the PR and between 7ffd154 and 7cde4e6.

📒 Files selected for processing (6)
  • .golangci.yml
  • internal/config/config.go
  • internal/writer/csv.go
  • internal/writer/parquet.go
  • internal/writer/writer.go
  • mmdbconvert.go
📝 Walkthrough

Walkthrough

The release workflow now runs on manual, pull request, push-to-main, and published release events. Shared config constants replace several string-based output and network type checks, and the lint/link checker configs were updated accordingly.

Changes

Release Workflow Update

Layer / File(s) Summary
Workflow trigger and job gating changes
.github/workflows/release.yml
Adds workflow_dispatch, pull_request, and push to main, plus published release triggers; adds a non-release goreleaser-check job with snapshot mode and read-only permissions.
Published release job permissions
.github/workflows/release.yml
Restricts goreleaser to published release events, adds environment: release, and moves contents: write to the job level.

Lint and Link-check Config

Layer / File(s) Summary
Gomodguard v2 configuration
.golangci.yml
Disables gomodguard in favor of gomodguard_v2 and rewrites the blocked-module configuration into the new v2 layout with direct module entries.
Lychee fragment setting
lychee.toml
Changes include_fragments from a boolean value to the string full.

Config and Writer Constant Migration

Layer / File(s) Summary
Shared constants and defaults
internal/config/config.go
Adds exported output-format, network-column, and column-type constants, then updates default selection and validation to use them for output formats, compression, network columns, bucket handling, and type hints.
CSV network type handling
internal/writer/csv.go
Updates CSV writer range detection and network value generation to use config network-column constants for CIDR, start/end IP, integer, and bucket cases.
Parquet type and compression handling
internal/writer/parquet.go
Replaces raw string and writer constant matching in parquet generation with config constants for network columns, data types, sorting, and compression codec selection.
Writer and mmdb type lookups
internal/writer/writer.go, mmdbconvert.go
Removes local network-column constants from writer.go and updates mmdbconvert.go to use config output-format and network-column constants for writer selection and validation.

Estimated code review effort: 4 (Complex) | ~45 minutes

Poem

A bunny in the buildroom sat,
With constants neat and configs flat.
Releases hopped on their proper cue,
And link checks learned a fuller view.
Through CSV, Parquet, mmdb glow,
The rabbit left a tidy flow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is clear and directly reflects the workflow change to run the release job in the release environment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch greg/stf-42-release-workflow-environment

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 4-16: The new workflow triggers are currently ineffective because
the only job, goreleaser, still runs only for github.event_name == 'release'
with action 'published'. Update the workflow so workflow_dispatch, pull_request,
and push either have a job that can actually run on those events or adjust the
goreleaser job’s if condition to allow the intended non-release paths; use the
goreleaser job definition and its event guard as the main place to fix this.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 64544e2f-9611-4d2d-a5f9-c1fefe18bd89

📥 Commits

Reviewing files that changed from the base of the PR and between 9e964ed and 09b4599.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

Comment thread .github/workflows/release.yml
oschwald added 3 commits July 7, 2026 13:50
Align the release workflow with mmdbinspect's: trigger on release:
published (with workflow_dispatch/pull_request/push-to-main for CI),
run the goreleaser job in the release deployment environment, scope
contents: write to the job, and guard the job so it only runs for
published releases.
@oschwald oschwald force-pushed the greg/stf-42-release-workflow-environment branch from 09b4599 to 2cbe392 Compare July 7, 2026 20:53
@oschwald oschwald force-pushed the greg/stf-42-release-workflow-environment branch from eb853b4 to 7ffd154 Compare July 7, 2026 22:17

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/config/config.go`:
- Around line 263-266: The default Parquet column definitions in
config.Network.Columns are using the type constants as the column Name, which
ties emitted headers to the constant values. Update the NetworkColumn entries in
the config setup to use explicit name literals instead of
NetworkColumnTypeStartInt/NetworkColumnTypeEndInt for Name, and verify the
defaults still match the previously expected Parquet headers so there is no
regression.

In `@internal/writer/parquet.go`:
- Around line 24-28: The parquet compression values are duplicated between the
writer and config, which can let validation and codec dispatch drift out of
sync. Update `internal/writer/parquet.go` to reuse the exported
`config.parquetCompression{None,Snappy,Gzip,Lz4,Zstd}` constants instead of
redeclaring `compressionNone` through `compressionZstd`, and make sure both the
allow-list and `getCompressionCodec` reference the shared config symbols.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e6a4b598-489a-4be8-bcc9-02bb69cc6760

📥 Commits

Reviewing files that changed from the base of the PR and between 2cbe392 and 7ffd154.

📒 Files selected for processing (7)
  • .golangci.yml
  • internal/config/config.go
  • internal/writer/csv.go
  • internal/writer/parquet.go
  • internal/writer/writer.go
  • lychee.toml
  • mmdbconvert.go

Comment thread internal/config/config.go
Comment on lines 263 to 266
config.Network.Columns = []NetworkColumn{
{Name: "start_int", Type: "start_int"},
{Name: "end_int", Type: "end_int"},
{Name: NetworkColumnTypeStartInt, Type: NetworkColumnTypeStartInt},
{Name: NetworkColumnTypeEndInt, Type: NetworkColumnTypeEndInt},
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Default Parquet column Name reuses the type constant.

{Name: NetworkColumnTypeStartInt, Type: NetworkColumnTypeStartInt} sets the column name to the same string as its type ("start_int"/"end_int"). This couples the default column name to the type constant's value — if the type constants are ever renamed the emitted column headers change with them, which is easy to miss. The CSV default correctly uses a descriptive literal (Name: "network"). Prefer explicit name literals here too, and confirm these match the previously-emitted default Parquet column names (no accidental header regression).

♻️ Suggested change
 		case OutputFormatParquet:
 			// Parquet default: integer columns for query performance
 			config.Network.Columns = []NetworkColumn{
-				{Name: NetworkColumnTypeStartInt, Type: NetworkColumnTypeStartInt},
-				{Name: NetworkColumnTypeEndInt, Type: NetworkColumnTypeEndInt},
+				{Name: "start_int", Type: NetworkColumnTypeStartInt},
+				{Name: "end_int", Type: NetworkColumnTypeEndInt},
 			}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
config.Network.Columns = []NetworkColumn{
{Name: "start_int", Type: "start_int"},
{Name: "end_int", Type: "end_int"},
{Name: NetworkColumnTypeStartInt, Type: NetworkColumnTypeStartInt},
{Name: NetworkColumnTypeEndInt, Type: NetworkColumnTypeEndInt},
}
config.Network.Columns = []NetworkColumn{
{Name: "start_int", Type: NetworkColumnTypeStartInt},
{Name: "end_int", Type: NetworkColumnTypeEndInt},
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/config/config.go` around lines 263 - 266, The default Parquet column
definitions in config.Network.Columns are using the type constants as the column
Name, which ties emitted headers to the constant values. Update the
NetworkColumn entries in the config setup to use explicit name literals instead
of NetworkColumnTypeStartInt/NetworkColumnTypeEndInt for Name, and verify the
defaults still match the previously expected Parquet headers so there is no
regression.

Comment thread internal/writer/parquet.go Outdated
@oschwald oschwald force-pushed the greg/stf-42-release-workflow-environment branch from 7ffd154 to 7cde4e6 Compare July 7, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant