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

Add parameterized CNB_PLATFORM_API to buildpacks strategy #990

Conversation

dalbar
Copy link
Member

@dalbar dalbar commented Jan 20, 2022

Changes

Buildpacks defines versioned api specification that allows them to bridge the knowledge gap between the lifecycle and the independent buildpack implementations. More specifically it allows the lifecycle utility to enable features based on the known api version and thus staying backward-compatible.

The lifecycle utility receives the api version from the environment variable CNB_PLATFORM_API. Whenever this variable is not present, it assumes per default that the version is 0.3. Consequently, the lifecycle’s exporter ignores the default process determined in the build step and sets the entrypoint of the resulting image to the lifecycle’s launcher executable (code reference). The launcher itself is called without an argument and thus assumes that the default process is web.

The interactions above break simple programs such as https://github.com/IBM/CodeEngine/tree/main/job.

The PR proposes a minimum version of 0.4 based on evaluating the api version of all buildpacks in the paketo organization. The version introduces multicall-launchers and produces non-broken images for the example above.

For buildpacks that do not set a default process, the 0.3 version of the api assigned the web process as default. This is not producible with the previous approach of using creator and the version 0.4. Thus this PR splits the creator into its subcomponents to achieve a flexible point to inject the default process. As a side-effect, the changes remain compatible with paketo and heroku.

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.

Release Notes

The buildpacks strategy now assumes the version "0.4" as its platform api version. The buildpacks strategies are more granular in their build process and chose "web" as a default process.

/kind bug

@openshift-ci openshift-ci bot added kind/bug Categorizes issue or PR as related to a bug. release-note Label for when a PR has specified a release note labels Jan 20, 2022
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

parameters:
- name: platform-api-version
description: The referenced version is the minimum version that all relevant buildpack implementations support.
default: "0.4"
Copy link
Member

Choose a reason for hiding this comment

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

Have you checked the Heroku buildpacks as well wrt their platform API versions?

@SaschaSchwarze0 SaschaSchwarze0 added this to the release-v0.8.0 milestone Jan 20, 2022
@dalbar dalbar marked this pull request as draft January 20, 2022 15:57
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 20, 2022
@gabemontero gabemontero modified the milestones: release-v0.8.0, Backlog Jan 31, 2022
@qu1queee
Copy link
Contributor

qu1queee commented Feb 9, 2022

From Grooming, @dalbar I think is fine to move here the additional changes you have in downstream.

Sets the minimum platform api version for all buildpack implementations which is relevant for the lifecycle utility in the buildpack's builder.

Relevant for setting the default process for simple go-applications automatically.

When the buildpack is not setting a default process, the scripts assign 'web' as default process.
@dalbar dalbar force-pushed the add/buildpack-api-version-as-param branch from 84e4ded to 37236b0 Compare February 17, 2022 15:11
@dalbar dalbar marked this pull request as ready for review February 17, 2022 15:19
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 17, 2022
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 18, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 18, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SaschaSchwarze0

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 18, 2022
@openshift-merge-robot openshift-merge-robot merged commit 594cd35 into shipwright-io:main Feb 18, 2022
@dalbar dalbar deleted the add/buildpack-api-version-as-param branch February 26, 2022 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Label for when a PR has specified a release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants