Skip to content

feat: add itest_local_environment rule - #96

Open
rafikk wants to merge 1 commit into
hermeticbuild:masterfrom
rafikk:rafikk/nkkqylysynoq
Open

rafikk wants to merge 1 commit into
hermeticbuild:masterfrom
rafikk:rafikk/nkkqylysynoq

Conversation

@rafikk

@rafikk rafikk commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

This PR introduces itest_local_environment, a rule for declaring a bazel runnable target for local development. It is very similar to itest_service_group but carries an additional attribute for explicitly mapping port labels to stable port numbers.

Unlike itest_service_group, it is intended to be a terminal rule. It does not return _ServiceGroupInfo, meaning it cannot be used as a dependency in service_test or composed with other service groups or local environments. The purpose of the target is strictly interactive local development via bazel run.

The primary motivation for this PR is to avoid the use of Bazel flags for port mapping. While the Bazel flags are very flexible, they have a few downsides:

  1. They're very verbose for command-line usage
  2. They're not easily shared without storing in bazelrc
  3. They can't be stored in bazelrc without a config prefix as the flags then also apply to integration tests
  4. Storing in bazelrc often requires a repo-wide coordination of reserved ports

itest_local_environment avoids these problems. It encodes the port reservations in Starlark, and port numbers only need to be unique within a specific environment target. As these are intended for end-users, port collisions across disjoint environments/groups do not cause a problem in practice.

The port_assignments continue to be overridable via Bazel flags.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4540fe7f4f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread cmd/svcinit/main.go Outdated
Comment thread cmd/svcinit/main.go Outdated
@rafikk
rafikk force-pushed the rafikk/nkkqylysynoq branch 3 times, most recently from ccd5d84 to 17f0214 Compare September 16, 2026 15:55
Comment thread itest.bzl Outdated
@rafikk
rafikk force-pushed the rafikk/nkkqylysynoq branch from 17f0214 to a677414 Compare September 17, 2026 08:12
@rafikk
rafikk force-pushed the rafikk/nkkqylysynoq branch from a677414 to 014240d Compare September 17, 2026 10:00
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