Skip to content
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

Enhance build plan and expose env vars during detection #27

Merged
merged 4 commits into from
Nov 20, 2018

Conversation

sclevine
Copy link
Member

@sclevine sclevine commented Nov 5, 2018

Formalizes #24.

@sclevine sclevine self-assigned this Nov 5, 2018
Copy link
Contributor

@nebhale nebhale left a comment

Choose a reason for hiding this comment

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

Just some questions that might lead to some clarifications.

buildpack.md Show resolved Hide resolved
buildpack.md Outdated Show resolved Hide resolved
buildpack.md Outdated
The lifecycle MUST NOT include any changes in this map that are output by optional buildpacks that returned non-zero exit statuses.
The final Build Plan is the complete combined map that includes the output of the final `/bin/detect` executable.
The lifecycle MUST NOT include any changes in this map that are contributed by optional buildpacks that returned non-zero exit statuses.
The final Build Plan is the fully-merged merged map that includes the contributions of the final `/bin/detect` executable.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the definition of "fully-merged" ever defined anywhere? Is it some sort of deep merge, a last-wins shallow merge, or something else?

Copy link
Member Author

Choose a reason for hiding this comment

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

The last-wins shallow merge behavior is defined with:

The lifecycle MUST construct this map such that the top-level values from later buildpacks override the entire top-level values from earlier buildpacks.

@@ -639,7 +669,6 @@ Buildpacks MUST specify:
```toml
[<dependency name>]
version = "<dependency version>"
provider = "<buildpack ID>"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@nebhale
Copy link
Contributor

nebhale commented Nov 5, 2018

@jkutner and @hone If possible, I'd love for you to review this ASAP. At the moment our buildpack development is being delayed by the lack of environment variables at detect time and this would free us up to proceed.

@jkutner
Copy link
Member

jkutner commented Nov 5, 2018

@sclevine is there a coupling between the build plan changes and the env vars for bin/detect? The latter seems far less intrusive, and I think we could merge that quickly to unblock @nebhale. The Build Plan changes are more to chew on.

buildpack.md Outdated
@@ -70,19 +70,23 @@ The lifecycle MUST invoke these executables as described in the Phase sections.

Executable: `/bin/detect`, Working Dir: `<app[AR]>`
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to add <platform[AR]> here.

Copy link
Member

Choose a reason for hiding this comment

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

Actually <platform[A]> because of the build plan

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! Fixed

@jkutner
Copy link
Member

jkutner commented Nov 5, 2018

@nebhale can you give me an example use case for needing env vars during detect? Because we're talking about a new arg to /bin/detect I really want this think this through

@nebhale
Copy link
Contributor

nebhale commented Nov 5, 2018

@jkutner In general, we use service bindings to declare intent for our integrations; e.g. existence of a new-relic service means you want the buildpack to put a New Relic javaagent on the command line and ensure that the licenseKey is extracted and set as a system property. However, there are a small handful of integrations that are not triggered by service bindings like Debug and JMX integrations. Today these are governed by setting a configuration value (i.e. cf set-env <APP> JBP_CONFIG_DEBUG '{ enabled : true }'). The CNB equivalent of that would be the existence of $BP_DEBUG and we cannot determine that at detect time today.

@sclevine
Copy link
Member Author

sclevine commented Nov 5, 2018

Both the build plan changes and exposing the environment variables require adding the <platform> directory as an argument to /bin/detect.

The only breaking change is that /bin/detect has to write build plan additions to the <platform> directory. However, this normalizes the /bin/build and /bin/detect interfaces so that they both can log to stdout. This seems desirable, regardless of any other changes.

@sclevine
Copy link
Member Author

sclevine commented Nov 5, 2018

I have a use case for user-provided env vars in /bin/detect as well. For the CF ruby buildpack, we look at BUNDLE_GEMFILE to determine whether your app is a ruby app with a non-standard Gemfile location.

- Normalize build/detect interfaces
- Require Bash 3 for develop

Signed-off-by: Stephen Levine <stephen.levine@gmail.com>
Signed-off-by: Stephen Levine <stephen.levine@gmail.com>
Copy link
Member

@jkutner jkutner left a comment

Choose a reason for hiding this comment

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

Thanks for working me through this.

nebhale added a commit to buildpacks/libbuildpack that referenced this pull request Nov 6, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/libcfbuildpack that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/libcfbuildpack that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/openjdk-cnb that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/jvm-application-cnb that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/build-system-cnb that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/libcfbuildpack that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/openjdk-cnb that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/jvm-application-cnb that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/build-system-cnb that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/libcfbuildpack that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/openjdk-cnb that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/jvm-application-cnb that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/build-system-cnb that referenced this pull request Nov 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
Copy link
Contributor

@nebhale nebhale left a comment

Choose a reason for hiding this comment

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

I'd like <plan> to move to $2 in build and develop for symmetry.

Copy link
Contributor

@nebhale nebhale left a comment

Choose a reason for hiding this comment

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

I'd like <plan> to move to $2 in build and develop for symmetry.

buildpack.md Outdated
@@ -110,7 +115,7 @@ Executable: `/bin/build <platform[AR]> <cache[EC]> <launch[EI]>`, Working Dir: `

### Development

Executable: `/bin/develop <platform[A]> <cache[EC]>`, Working Dir: `<app[A]>`
Executable: `/bin/develop <platform[AR]> <cache[EC]>`, Working Dir: `<app[A]>`
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing <plan>

Signed-off-by: Stephen Levine <stephen.levine@gmail.com>
Copy link
Contributor

@nebhale nebhale left a comment

Choose a reason for hiding this comment

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

Ship it.

@sclevine sclevine merged commit 9dc3139 into master Nov 20, 2018
nebhale added a commit to buildpacks/libbuildpack that referenced this pull request Nov 27, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to buildpacks/libbuildpack that referenced this pull request Nov 28, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/libcfbuildpack that referenced this pull request Nov 28, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to buildpacks/libbuildpack that referenced this pull request Nov 28, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/libcfbuildpack that referenced this pull request Nov 28, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <platform>/plan, and updates Build to allow
claims on build plan dependencies via <platform>/plan.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to buildpacks/libbuildpack that referenced this pull request Nov 28, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to buildpacks/libbuildpack that referenced this pull request Nov 28, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/libcfbuildpack that referenced this pull request Nov 29, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/libcfbuildpack that referenced this pull request Nov 29, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to buildpacks/libbuildpack that referenced this pull request Nov 29, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/libcfbuildpack that referenced this pull request Nov 29, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/openjdk-cnb that referenced this pull request Nov 29, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/openjdk-cnb that referenced this pull request Nov 29, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/jvm-application-cnb that referenced this pull request Nov 29, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/build-system-cnb that referenced this pull request Nov 30, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to cloudfoundry/debug-cnb that referenced this pull request Nov 30, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to projectriff/libfnbuildpack that referenced this pull request Nov 30, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to projectriff/libfnbuildpack that referenced this pull request Nov 30, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to projectriff/libfnbuildpack that referenced this pull request Nov 30, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to projectriff/libfnbuildpack that referenced this pull request Dec 1, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to projectriff/libfnbuildpack that referenced this pull request Dec 5, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>
nebhale added a commit to projectriff/libfnbuildpack that referenced this pull request Dec 13, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>

[ci skip] Incremental commit. Please do not base any external work off of this commit.

Signed-off-by: Ben Hale <bhale@pivotal.io>
ericbottard pushed a commit to ericbottard/libfnbuildpack that referenced this pull request Dec 18, 2018
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>

[ci skip] Incremental commit. Please do not base any external work off of this commit.

Signed-off-by: Ben Hale <bhale@pivotal.io>
ericbottard pushed a commit to projectriff/libfnbuildpack that referenced this pull request Jan 24, 2019
This change updates the library to match upcoming spec changes.  It adds the
Platform to Detect, updates the Detect logger to use stdout, updates Detect's
build plan output to write to <plan>, and updates Build to allow claims on
build plan dependencies via <plan>.

[buildpacks/spec#27]

Signed-off-by: Ben Hale <bhale@pivotal.io>

[ci skip] Incremental commit. Please do not base any external work off of this commit.

Signed-off-by: Ben Hale <bhale@pivotal.io>
@nebhale nebhale deleted the 24-enhanced-build-plan branch August 30, 2019 17:14
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.

3 participants