Skip to content

Remove embedded extension config, make --extensions-dir required (Phase 5) - #127

Merged
tnikolova82 merged 1 commit into
mainfrom
remove-embedded-extensions
Oct 30, 2026
Merged

tnikolova82 merged 1 commit into
mainfrom
remove-embedded-extensions

Conversation

@tnikolova82

@tnikolova82 tnikolova82 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Remove the go:embed-based extension loading from binary-builder. Extension YAML files now live exclusively in the php-buildpack repo and must be passed via --extensions-dir during PHP builds.

Context

This is Phase 5 (final phase) of the PHP extension config migration plan.

Prerequisites (must ALL be merged and validated first)

  • Phase 1: binary-builder PR #126 — adds --extensions-dir flag
  • Phase 2: php-buildpack PR #1332 — adds config/extensions/ directory (merged Oct 29)
  • Phase 4: buildpacks-ci PR #696 — adds EXTENSIONS_DIR support to update.rb and fixes update-hashes.rb (merged Oct 29). Critical: must merge before this PR. Without PR #696, the weekly GitHub Actions workflow (check-php-extensions.yml) will silently fail to find extension YAML files after this PR renames internal/php/assets/ to internal/php/testdata/. The old update.rb on buildpacks-ci master hardcodes the path internal/php/assets via its BINARY_BUILDER_DIR fallback — that directory no longer exists after this PR. PR #696 adds EXTENSIONS_DIR support, and the workflow already sets EXTENSIONS_DIR with a fallback chain that handles the rename.
  • Phase 3: buildpacks-ci PR #697 — wires pipeline to pass --extensions-dir (merged Oct 29)
  • Phase 3 validated — successful builds for all version lines on both stacks (Oct 30):
  • Verify GitHub Actions workflow — after this PR merges, internal/php/assets/ becomes internal/php/testdata/. The weekly check-php-extensions.yml workflow uses an EXTENSIONS_DIR fallback chain (php-buildpack/config/extensions > internal/php/assets > internal/php/testdata) that handles this automatically. Verify the workflow still runs successfully by triggering a manual run after merge.

Merge order (critical)

PR #696  (EXTENSIONS_DIR support)  ── must merge before this PR  ✅ merged
PR #1332 (Phase 2)                 ── must merge before PR #697  ✅ merged
PR #697  (Phase 3)                 ── must merge and validate before this PR  ✅ merged + validated
PR #127  (this PR / Phase 5)       ── merge last  ⬅️ READY

Changes

File Change
internal/php/assets/ → internal/php/testdata/ YAML files moved from embedded assets to test-only fixtures
internal/php/extensions.go Removed go:embed, init(), embeddedBases/embeddedPatches maps. LoadFromDir is the sole production API. Load() is now a test-only wrapper.
internal/recipe/php.go ExtensionsDir is now required. Build() returns clear error when empty.
internal/recipe/php_test.go All tests updated to pass ExtensionsDir. New TestPHPRecipeBuildRequiresExtensionsDir test.
AGENTS.md Updated to reflect new structure

Breaking Change

After this PR merges, running binary-builder build for PHP without --extensions-dir will fail with:

php: --extensions-dir is required for PHP builds (extension config has moved to the php-buildpack repo)

This is intentional — the CI pipeline (Phase 3) always passes --extensions-dir, so production builds are unaffected. Local development builds need to pass the flag explicitly.

Rollback

If issues arise, revert this commit to restore the embedded extension config. The --extensions-dir flag will continue to work (it takes precedence over embedded defaults in the Phase 1 code).

ivanovac
ivanovac previously approved these changes Oct 28, 2026

@ivanovac ivanovac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@tnikolova82
tnikolova82 dismissed ivanovac’s stale review October 28, 2026 12:12

The merge-base changed after approval.

…se 5)

Remove the go:embed-based extension loading from binary-builder. Extension
YAML files now live exclusively in the php-buildpack repo (config/extensions/)
and must be passed via --extensions-dir during PHP builds.

Changes:

1. Move internal/php/assets/ to internal/php/testdata/. The YAML files
   are now test fixtures only, not compiled into the binary.

2. Remove go:embed infrastructure from extensions.go: the embedded FS,
   init() function, regex matchers, and embeddedBases/embeddedPatches
   maps are all removed. LoadFromDir is the sole production API.

3. Load() now delegates to LoadFromDir("testdata", ...) and is
   documented as a test-only convenience function.

4. PHPRecipe.ExtensionsDir is now required. Build() returns a clear
   error when it is empty: "--extensions-dir is required for PHP builds".

5. All php_test.go tests updated to pass ExtensionsDir. New test
   TestPHPRecipeBuildRequiresExtensionsDir verifies the error path.

6. AGENTS.md updated to reflect the new structure.

DO NOT MERGE until Phase 3 (buildpacks-ci pipeline passing --extensions-dir)
has been running successfully in production for at least one full PHP release
cycle.

Prerequisites:
- binary-builder PR #126 (Phase 1) — merged
- php-buildpack PR #1332 (Phase 2) — merged
- buildpacks-ci Phase 3 PR — merged and validated
@tnikolova82
tnikolova82 force-pushed the remove-embedded-extensions branch from 8a23f3c to 31902ec Compare October 28, 2026 13:45
@tnikolova82 tnikolova82 changed the title DO NOT MERGE — Remove embedded extension config, make --extensions-dir required (Phase 5) Remove embedded extension config, make --extensions-dir required (Phase 5) Oct 30, 2026
@tnikolova82
tnikolova82 requested a review from ivanovac October 30, 2026 09:59
@tnikolova82

Copy link
Copy Markdown
Contributor Author

Phase 3 Validation Complete — Ready for Review

All prerequisites are now met. Phase 3 has been validated with successful builds across all PHP version lines and both stacks:

Version Build Status Stacks Extension Config
PHP 8.2.x #22 ✅ succeeded cflinuxfs4 + cflinuxfs5 [task] Using extension config from php-buildpack/config/extensions
PHP 8.3.x #24 ✅ succeeded cflinuxfs4 + cflinuxfs5 [task] Using extension config from php-buildpack/config/extensions
PHP 8.4.x #12 ✅ succeeded cflinuxfs4 + cflinuxfs5 [task] Using extension config from php-buildpack/config/extensions
PHP 8.5.x #13 ✅ succeeded cflinuxfs4 + cflinuxfs5 [task] Using extension config from php-buildpack/config/extensions

All prerequisite PRs merged:

The only remaining post-merge task is verifying the GitHub Actions check-php-extensions.yml workflow still runs correctly after the internal/php/assets/ → internal/php/testdata/ rename.

Updated the PR description with checked boxes and removed "DO NOT MERGE" from the title. Requesting fresh review.

@ivanovac ivanovac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@tnikolova82
tnikolova82 merged commit 88c5774 into main Oct 30, 2026
1 check passed
@tnikolova82
tnikolova82 deleted the remove-embedded-extensions branch October 30, 2026 13:10
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