Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Envoy CI needs to test against current commit ($GITHUB_SHA), and release branches require different Envoy versions. Currently, these values are hardcoded in MODULE.bazel and .bazelrc.

Changes

Template-based configuration

  • MODULE.bazel.tpl - Parameterizes git_override blocks with ${ENVOY_COMMIT} for envoy, envoy_api, envoy_build_config, and envoy_mobile modules
  • registry.bazelrc.tpl - Parameterizes registry URL with ${REGISTRY_URL}
  • .bazelrc - Added try-import %workspace%/registry.bazelrc for generated config

Build infrastructure

  • shared/build/Dockerfile - Install gettext-base (provides envsubst), add build args
  • shared/build/build-entrypoint.sh - Generate config files from templates before build execution
  • docker-compose-wasm.yaml - Pass environment variables as build args with defaults using YAML anchors

Usage

# Default (e1d1bcc84e310bc35d46bb2d78297159fc4f3e9f)
docker-compose -f docker-compose-wasm.yaml build

# CI with current commit
ENVOY_COMMIT=$GITHUB_SHA docker-compose -f docker-compose-wasm.yaml build

# Custom registry
REGISTRY_URL=https://custom.registry.com docker-compose -f docker-compose-wasm.yaml build

Default values:

  • ENVOY_COMMIT: e1d1bcc84e310bc35d46bb2d78297159fc4f3e9f
  • REGISTRY_URL: https://raw.githubusercontent.com/phlax/bazel-central-registry/b739c7fa56b971d695af9600b88099236dcfef76
Original prompt

Context

This is a follow-up to PR #1041 (#1041) which adds the http-filter-cc example using bzlmod.

The current implementation hardcodes the Envoy commit hash in MODULE.bazel via git_override and the registry URL in .bazelrc. This needs to be configurable for:

  1. Envoy CI: When running tests from Envoy's CI, it should use the current Envoy commit ($GITHUB_SHA)
  2. Release branches: May need different override configurations
  3. Registry URL: Currently uses a specific registry hash, but should be overridable for testing and eventually use a fixed registry address

Required Changes

1. Create MODULE.bazel.tpl

Rename/convert MODULE.bazel to MODULE.bazel.tpl with ${ENVOY_COMMIT} placeholder in the git_override blocks:

git_override(
    module_name = "envoy",
    commit = "${ENVOY_COMMIT}",
    remote = "https://github.com/envoyproxy/envoy",
)

git_override(
    module_name = "envoy_api",
    commit = "${ENVOY_COMMIT}",
    remote = "https://github.com/envoyproxy/envoy",
    strip_prefix = "api",
)

2. Create registry.bazelrc.tpl

Create a new template file with the registry URL placeholder:

common --registry=${REGISTRY_URL}

3. Update .bazelrc

Remove the phlax registry line and add a try-import for the generated registry config:

try-import %workspace%/registry.bazelrc

Keep the other two registries (bcr.bazel.build and envoyproxy/toolshed) as they are static.

4. Update Dockerfile

Add build args and envsubst processing:

ARG ENVOY_COMMIT
ARG REGISTRY_URL

# Generate config files from templates
RUN envsubst '${ENVOY_COMMIT}' < MODULE.bazel.tpl > MODULE.bazel \
    && if [ -f registry.bazelrc.tpl ]; then \
           envsubst '${REGISTRY_URL}' < registry.bazelrc.tpl > registry.bazelrc; \
       fi

5. Update docker-compose.yml

Pass through the new environment variables as build args:

args:
  GITHUB_TOKEN: "${GITHUB_TOKEN}"
  ENVOY_COMMIT: "${ENVOY_COMMIT:-e1d1bcc84e310bc35d46bb2d78297159fc4f3e9f}"
  REGISTRY_URL: "${REGISTRY_URL:-https://raw.githubusercontent.com/phlax/bazel-central-registry/b739c7fa56b971d695af9600b88099236dcfef76}"

Reference

Base the changes on the files from PR #1041: #1041

The current hardcoded values to use as defaults:

  • ENVOY_COMMIT: e1d1bcc84e310bc35d46bb2d78297159fc4f3e9f
  • REGISTRY_URL: https://raw.githubusercontent.com/phlax/bazel-central-registry/b739c7fa56b971d695af9600b88099236dcfef76

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 4, 2026 09:52
…mit and registry

Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
…e defaults

Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot AI changed the title [WIP] Update MODULE.bazel to support configurable Envoy settings Make wasm-cc Envoy commit and registry URL configurable via environment variables Feb 4, 2026
Copilot AI requested a review from phlax February 4, 2026 09:57
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.

2 participants