-
Notifications
You must be signed in to change notification settings - Fork 346
Modernize packaging to use Go-based buildpack-packager #1200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace deprecated Ruby gem-based packaging with Go-based buildpack-packager, bringing the PHP buildpack in line with all other Cloud Foundry buildpacks. Changes: - Add buildpack-packager::install function to scripts/.util/tools.sh - Refactor scripts/package.sh to use Go-based packager - Delete obsolete cf.Gemfile and cf.Gemfile.lock - Update README.md with modernized packaging instructions - Remove cf.Gemfile references from manifest.yml exclude_files - Modernize scripts/brats.sh to use Go-based packager - Enable buildpack-packager install in scripts/integration.sh (consistent with other buildpacks) - Remove newrelic from default_versions in manifest.yml The newrelic removal is required because the Go-based packager correctly validates semantic versions and rejects 4-part versions (10.21.0.11). NewRelic remains fully functional at runtime via compile-extensions fallback mechanism that automatically selects the single available version from the dependencies section. This change eliminates Docker and Ruby dependencies for packaging while maintaining complete backward compatibility at runtime. Stats: 8 files changed, 52 insertions(+), 99 deletions(-)
ivanovac
approved these changes
Nov 6, 2025
ivanovac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ramonskie
added a commit
to cloudfoundry/buildpacks-ci
that referenced
this pull request
Nov 6, 2025
All Cloud Foundry buildpacks now use compile_extensions: false and Go-based packaging, making the legacy Ruby gem-based compile-extensions infrastructure obsolete. This change removes: - compile-extensions git resource from pipeline - buildpack-packager GitHub release resource from pipeline - update-compile-extensions job - update-buildpack-packager job - Legacy Ruby bundler packaging logic from buildpack-tagger.rb - Hardcoded PHP v4.5.3 Gemfile download URLs - compile_extensions field from all buildpack values files Impact: - 66 lines removed from pipeline.yml - 30 lines removed from buildpack-tagger.rb - 2 task files deleted (update-compile-extensions) - 14 buildpack values files cleaned up This completes the buildpack modernization effort, ensuring all buildpacks use consistent Go-based tooling. PHP buildpack packaging was modernized in cloudfoundry/php-buildpack#1200. Related: cloudfoundry/php-buildpack#1200
7 tasks
Add scripts/install_go.sh to download and install Go 1.22.5 during buildpack execution. This enables on-the-fly compilation of Go-based buildpack code, following the pattern used in the go-buildpack and ruby-buildpack reference implementations.
Implement supply, finalize, detect, release, start, and rewrite phases in Go: - supply.go: Dependency installation, PHP/HTTPD/Nginx setup, extension management - finalize.go: Final configuration and runtime preparation - detect.go: Buildpack detection logic - release.go: Release metadata generation - start.go: Process manager for running multiple services - rewrite.go: Configuration file template substitution This migration aligns with Cloud Foundry's libbuildpack architecture used in reference buildpacks.
Convert all buildpack extensions to Go: - extension.go: Base extension interface and lifecycle management - appdynamics.go: AppDynamics APM integration - composer.go: PHP Composer dependency management (856 lines) - dynatrace.go: Dynatrace APM integration (524 lines) - newrelic.go: New Relic APM integration - sessions.go: PHP session storage configuration Each extension implements compile-time and runtime hooks for modifying buildpack behavior.
Implement configuration system with embedded defaults: - config.go: Configuration file discovery and management - options.go: Options parsing from options.json with validation - hooks.go: Lifecycle hook definitions - config/defaults/: Embedded default configs for HTTPD, Nginx, PHP-FPM Embedded defaults enable the buildpack to function without external dependencies. Includes comprehensive unit tests for options parsing.
Replace Python-based scripts with Go compilation wrappers: - bin/detect: Compile and run detect.go - bin/supply: Compile and run supply.go - bin/finalize: Compile and run finalize.go - bin/release: Compile and run release.go - bin/start: Compile and run start.go - bin/rewrite: Compile and run rewrite.go All scripts follow consistent pattern: install Go, compile binary with -mod=vendor, execute with arguments. This matches the architecture of reference Cloud Foundry buildpacks.
Adjust integration test setup to work with Go compilation: - init_test.go: Update test initialization and buildpack path handling - apms_test.go: Update APM integration test expectations - app_frameworks_test.go: Minor cleanup - composer_test.go: Update Composer test expectations Tests now account for Go compilation step during buildpack execution.
Add ARCHITECTURE.md (635 lines) documenting: - Migration rationale and goals - Go-based buildpack architecture - Supply/finalize phase separation - Extension system design - Configuration management approach - Comparison with Python implementation Update .gitignore to exclude Go build artifacts and temporary files.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Core Packaging
buildpack-packager::installfunction toscripts/.util/tools.shscripts/package.shto use Go-based packager (similar to go-buildpack)scripts/brats.shandscripts/integration.shto use Go-based packagerCleanup
cf.Gemfileandcf.Gemfile.lockcf.Gemfilereferences frommanifest.ymlexclude_filesREADME.mdwith modernized packaging instructionsNewRelic Configuration Fix
newrelicfromdefault_versionsinmanifest.ymlTesting
Benefits
✅ Removes Ruby and Docker dependencies for packaging
✅ Aligns with CF buildpack ecosystem standards
✅ Simplifies CI/CD pipeline requirements
✅ Maintains 100% backward compatibility at runtime