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

[RFC0028] Support for Cloud Native Buildpacks lifecycle #2871

Merged
merged 9 commits into from
Sep 23, 2024

Conversation

pbusko
Copy link
Contributor

@pbusko pbusko commented May 2, 2024

Where this PR should be backported?

  • main - all changes should by default start here
  • v8
  • v7

Description of the Change

This change introduces changes as described by RFC 0028 Cloud Native Buildpacks Lifecycle.

  • cf push accepts --lifecycle [buildpacks|docker|cnb] flag
  • cf push supports lifecycle option in the manifest
  • cf create-app --app-type extended with cnb option

Why Is This PR Valuable?

What benefits will be realized by the code change? What users would want this change? What user need is this change addressing?

Applicable Issues

List any applicable GitHub Issues here

How Urgent Is The Change?

Depends on cloudfoundry/cloud_controller_ng#3778 to be merged first

Other Relevant Parties

Who else is affected by the change?

@loewenstein-sap
Copy link

@cloudfoundry/toc Do you know who could be asked to review this one?

@beyhan
Copy link
Member

beyhan commented Jul 23, 2024

Hi @loewenstein-sap,

I asked in the CLI slack channel.

@pbusko pbusko force-pushed the cnb-lifecycle branch 3 times, most recently from 0bdafee to c1d9a1c Compare July 29, 2024 08:53
Copy link
Member

@a-b a-b left a comment

Choose a reason for hiding this comment

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

Implementation LGTM.
Is it possible to add integration tests?

@pbusko
Copy link
Contributor Author

pbusko commented Aug 5, 2024

@a-b would it be sufficient to simply enable CNB tests which are part of CATS? cloudfoundry/cf-acceptance-tests#1136 with "include_cnb": true?

Otherwise we would have to basically create test duplicates and test same things multiple times with no additional benefits.

Copy link
Member

@a-b a-b left a comment

Choose a reason for hiding this comment

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

LGTM

@pbusko pbusko force-pushed the cnb-lifecycle branch 2 times, most recently from 27f04c8 to 8647baf Compare August 15, 2024 06:05
@modulo11
Copy link
Contributor

@a-b could you assist us fixing the failing checks? The CVE check fails to download the Grype DB. Regarding the failed integration tests we are wondering if the targeted CF already supports Cloud Native Buildpacks and if the required feature-flag (diego_cnb) is activated.

@a-b
Copy link
Member

a-b commented Aug 16, 2024

@a-b could you assist us fixing the failing checks? The CVE check fails to download the Grype DB. Regarding the failed integration tests we are wondering if the targeted CF already supports Cloud Native Buildpacks and if the required feature-flag (diego_cnb) is activated.

At the moment, the integration test is being run against cf-deployment_version: v40.15.0. We do not support modifications to feature flags, but I will discuss with the team to explore potential solutions.

One possible approach to support feature flags would be to introduce a file in the repository with a BOSH opsfile that could be applied prior to running tests. Please, let us know what you think about this approach.

@modulo11
Copy link
Contributor

At the moment, the integration test is being run against cf-deployment_version: v40.15.0. We do not support modifications to feature flags, but I will discuss with the team to explore potential solutions.

One possible approach to support feature flags would be to introduce a file in the repository with a BOSH opsfile that could be applied prior to running tests. Please, let us know what you think about this approach.

Basic support for CNBs was released with v42.2.0, but it looks like our most recent changes are not released yet. Bumping the version now would not solve the issue, so I guess this will take a little longer.

Regarding the feature flag, we're using:

would that be enough once the integration tests consume the necessary cf-deployment version?

Copy link
Contributor

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

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

In general looks good, but the tests are failing I am guessing it is because we changed the output. Can you please check that?
Added some other nit's related to formatting the code.

actor/v7pushaction/handle_cnb_credentials_override.go Outdated Show resolved Hide resolved
actor/v7pushaction/handle_cnb_credentials_override_test.go Outdated Show resolved Hide resolved
actor/v7pushaction/handle_lifecycle_override.go Outdated Show resolved Hide resolved
command/v7/push_command.go Outdated Show resolved Hide resolved
command/v7/push_command.go Outdated Show resolved Hide resolved
command/v7/push_command.go Outdated Show resolved Hide resolved
}, nil
}

func (cmd PushCommand) ValidateFlags() error {
switch {
// Lifecycle buildpack requested

case cmd.Lifecycle == constant.AppLifecycleTypeBuildpack && cmd.DockerImage.Path != "":
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are checking for dockerImage and docker-username, would it make sense to also test for docker-password?

Copy link
Contributor

Choose a reason for hiding this comment

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

Wrong input combinations, in regards to docker, are checked earlier. I guess it does not make sense to check it again.

command/v7/shared/app_summary_displayer.go Show resolved Hide resolved
@pbusko
Copy link
Contributor Author

pbusko commented Sep 9, 2024

@pbusko, pelase confirm if cf-deployment v40.15.0 with capi-release 1.182.0 be sufficient to verify these changes.

@a-b capi-release with the version >= 1.186.0 and the cf-deployment with the version >= v42.3.0 are required, together with the enabled diego_cnb feature flag

@a-b
Copy link
Member

a-b commented Sep 16, 2024

The cfd pool was updated to v40.15.0 last week. The shepherd team is working on the next upgrade.

@a-b
Copy link
Member

a-b commented Sep 16, 2024

@dependabot /rebase

@a-b
Copy link
Member

a-b commented Sep 16, 2024

Great news! Version cfd v43.3.0 is now available in the pool. Re-running integration tests.

@a-b
Copy link
Member

a-b commented Sep 18, 2024

Fixed environment deployment.
@pbusko, please rebase, and 🤞 this should get integration tests run.

@a-b
Copy link
Member

a-b commented Sep 18, 2024

It seems that both 1 and 2 integrations test failures are related to build packs and CNB:

  [FAIL] app command when the environment is set up correctly version independent display when the app exists when the app is a CNB app [It] displays the app buildpacks
  /__w/cli/cli/integration/v7/isolated/app_command_test.go:419

I also noticed the following error:

  ERR: CNBDetectFailed - cnb: detecting failed

during the push app step.

@a-b
Copy link
Member

a-b commented Sep 19, 2024

Checked both failed integrations tests 1, 2 locally. It works fine 🤷

@a-b
Copy link
Member

a-b commented Sep 20, 2024

I do not have write access to your branch, but essentially to fix tests, you want something like the following patch:

commit 54c988b260c238264014b1831c0563dccd25c5fc
Author: Al Berez <al.berez@broadcom.com>
Date:   Fri Sep 20 14:19:55 2024 -0700

    Fix push command help integration test

diff --git a/integration/v7/push/help_test.go b/integration/v7/push/help_test.go
index 328459207..7503e313a 100644
--- a/integration/v7/push/help_test.go
+++ b/integration/v7/push/help_test.go
@@ -26,6 +26,7 @@ var _ = Describe("help", func() {
 				"[-b BUILDPACK_NAME]",
 				"[-c COMMAND]",
 				"[-f MANIFEST_PATH | --no-manifest]",
+				"[--lifecycle (buildpack | docker | cnb)]",
 				"[--no-start]",
 				"[--no-wait]",
 				"[-i NUM_INSTANCES]",

@a-b
Copy link
Member

a-b commented Sep 20, 2024

Question (blocking): Do you have all help updates, like docker mode, covered?
Please double-check to see if you updated all help messages related to your changes.

@a-b
Copy link
Member

a-b commented Sep 20, 2024

Suggestion: To expedite interactions with approvers in the future, when creating a PR, please enable approvers to push changes to your branch by checking the corresponding checkbox in your PR.

@a-b
Copy link
Member

a-b commented Sep 23, 2024

@pbusko, @modulo11, I wanted to check if you need more help with this merge.

c0d1ngm0nk3y and others added 9 commits September 23, 2024 15:41
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Nicolas Bender <nicolas.bender@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Nicolas Bender <nicolas.bender@sap.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: João Pereira <joaopapereira@gmail.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
@pbusko
Copy link
Contributor Author

pbusko commented Sep 23, 2024

@a-b thank you for your help, we've updated the PR with your suggestion

@a-b a-b merged commit 0cc96f4 into cloudfoundry:main Sep 23, 2024
16 of 17 checks passed
@a-b
Copy link
Member

a-b commented Sep 23, 2024

Broken linter is a known issue that is is progress. I'll go ahead and merge, as integration tests and CATs are green.

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.

8 participants