Skip to content

Commit 420c250

Browse files
Sophie Wigmorethitch97
Sophie Wigmore
andauthored
Remove buildpack.yml support (#377)
* remove buildpack.yml support * update README Co-authored-by: Tim Hitchener <thitch97@users.noreply.github.com>
1 parent d69ff4e commit 420c250

15 files changed

+59
-324
lines changed

README.md

+45-9
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,49 @@ This buildpack is released under version 2.0 of the [Apache License][a].
6161

6262
[a]: http://www.apache.org/licenses/LICENSE-2.0
6363

64-
## `buildpack.yml` Configurations
65-
66-
In order to specify a particular version of `php` you can
67-
provide an optional `buildpack.yml` in the root of the application directory.
68-
```yaml
69-
php:
70-
# this allows you to specify a version constraint for the `php` depdendency
71-
# any valid semver constaints (e.g. 7.*) are also acceptable
72-
version: 7.2.*
64+
## Run Tests
65+
66+
To run all unit tests, run:
67+
```
68+
./scripts/unit.sh
69+
```
70+
71+
To run all integration tests, run:
72+
```
73+
./scripts/integration.sh
74+
```
75+
76+
## Buildpack Configurations
77+
78+
### PHP Version
79+
Specifying the PHP Dist version through buildpack.yml configuration is deprecated.
80+
81+
To migrate from using `buildpack.yml` please set the `$BP_PHP_VERSION`
82+
environment variable at build time either directly (ex. `pack build my-app
83+
--env BP_PHP_VERSION=7.3.*`) or through a [`project.toml`
84+
file](https://github.com/buildpacks/spec/blob/main/extensions/project-descriptor.md)
85+
86+
```shell
87+
# this allows you to specify a version constraint for the `php` depdendency
88+
# any valid semver constaints (e.g. 7.*) are also acceptable
89+
$BP_PHP_VERSION="7.3.*"
90+
```
91+
### PHP library directory
92+
The PHP library directory is available to PHP via an include path in the PHP
93+
configuration. By default it is set to `/workspace/lib` and can be overriden by
94+
setting the `BP_PHP_LIB_DIR` environment variable at build-time.
95+
```shell
96+
$BP_PHP_LIB_DIR="some-directory"
7397
```
98+
99+
### Provide custom `.ini` files
100+
Custom `.ini` files can be provided from users to amend the default `php.ini`
101+
file. This can be done by placing an `ini`-type configuration file inside
102+
`<application directory>/.php.ini.d/`. It's path will be made avaialble via the
103+
`PHP_INI_SCAN_DIR`.
104+
105+
## Debug Logs
106+
For extra debug logs from the image build process, set the `$BP_LOG_LEVEL`
107+
environment variable to `DEBUG` at build-time (ex. `pack build my-app --env
108+
BP_LOG_LEVEL=DEBUG` or through a [`project.toml`
109+
file](https://github.com/buildpacks/spec/blob/main/extensions/project-descriptor.md).

build.go

-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/Masterminds/semver"
109
"github.com/paketo-buildpacks/packit/v2"
1110
"github.com/paketo-buildpacks/packit/v2/chronos"
1211
"github.com/paketo-buildpacks/packit/v2/postal"
@@ -87,14 +86,6 @@ func Build(entryResolver EntryResolver,
8786

8887
logger.SelectedDependency(entry, dependency, clock.Now())
8988

90-
source, _ := entry.Metadata["version-source"].(string)
91-
if source == "buildpack.yml" {
92-
nextMajorVersion := semver.MustParse(context.BuildpackInfo.Version).IncMajor()
93-
logger.Subprocess("WARNING: Setting the PHP version through buildpack.yml will be deprecated in %s v%s.", context.BuildpackInfo.Name, nextMajorVersion.String())
94-
logger.Subprocess("In versions >= v%s, use the $BP_PHP_VERSION environment variable to specify a version.", nextMajorVersion.String())
95-
logger.Break()
96-
}
97-
9889
logger.Debug.Process("Getting the layer associated with PHP:")
9990
phpLayer, err := context.Layers.Get(PHPDependency)
10091
if err != nil {

build_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
159159
}))
160160
Expect(entryResolver.ResolveCall.Receives.Priorities).To(Equal([]interface{}{
161161
"BP_PHP_VERSION",
162-
"buildpack.yml",
163162
"composer.lock",
164163
"composer.json",
165164
"default-versions",

buildpack_yml_parser.go

-54
This file was deleted.

buildpack_yml_parser_test.go

-89
This file was deleted.

constants.go

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const (
88

99
var EntryPriorities = []interface{}{
1010
"BP_PHP_VERSION",
11-
"buildpack.yml",
1211
"composer.lock",
1312
"composer.json",
1413
"default-versions",

detect.go

+1-23
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,12 @@ package phpdist
22

33
import (
44
"os"
5-
"path/filepath"
65

76
"github.com/paketo-buildpacks/packit/v2"
87
)
98

109
//go:generate faux --interface VersionParser --output fakes/version_parser.go
1110

12-
// VersionParser defines the interface for determining the version of php.
13-
type VersionParser interface {
14-
ParseVersion(path string) (version string, err error)
15-
}
16-
1711
// BuildPlanMetadata is the buildpack specific data included in build plan
1812
// requirements.
1913
type BuildPlanMetadata struct {
@@ -25,7 +19,7 @@ type BuildPlanMetadata struct {
2519
// detect phase of the buildpack lifecycle.
2620
//
2721
// Detect always passes, and will contribute a Build Plan that provides php.
28-
func Detect(buildpackYMLParser VersionParser) packit.DetectFunc {
22+
func Detect() packit.DetectFunc {
2923
return func(context packit.DetectContext) (packit.DetectResult, error) {
3024
var requirements []packit.BuildPlanRequirement
3125

@@ -40,22 +34,6 @@ func Detect(buildpackYMLParser VersionParser) packit.DetectFunc {
4034
})
4135
}
4236

43-
var err error
44-
version, err = buildpackYMLParser.ParseVersion(filepath.Join(context.WorkingDir, "buildpack.yml"))
45-
if err != nil {
46-
return packit.DetectResult{}, err
47-
}
48-
49-
if version != "" {
50-
requirements = append(requirements, packit.BuildPlanRequirement{
51-
Name: "php",
52-
Metadata: BuildPlanMetadata{
53-
Version: version,
54-
VersionSource: "buildpack.yml",
55-
},
56-
})
57-
}
58-
5937
return packit.DetectResult{
6038
Plan: packit.BuildPlan{
6139
Provides: []packit.BuildPlanProvision{

0 commit comments

Comments
 (0)