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

feat (jkube-kit) : Add configuration option for overriding buildpack builder image (#2470) #2940

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

rohanKanojia
Copy link
Member

@rohanKanojia rohanKanojia commented Apr 19, 2024

Description

Fix #2470

Add a field in ImageConfiguration's Build named buildpacksBuilderImage that can be used by the user for configuring buildpack builder image. This field would also be exposed via jkube.generator.buildpacksBuilderImage property and generators buildpacksBuilderImage config

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • I have read the contributing guidelines
  • I signed-off my commit with a user that has signed the Eclipse Contributor Agreement
  • My code follows the style guidelines of this project
  • I Keep It Small and Simple: The smaller the PR is, the easier it is to review and have it merged
  • I use conventional commits in my commit messages
  • I have performed a self-review of my code
  • I Added CHANGELOG entry
  • I have updated the documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@manusa
Copy link
Member

manusa commented Apr 19, 2024

Eclipse JKube CI Report

Started new GH workflow run for #2940 (2024-04-24T10:56:21Z)

⚙️ JKube E2E Tests (8815050588)

Test results

✔️ Test reports (OpenShift v3.10.0-quarkus)
[✓] QuarkusOcITCase - ocBuild - oc:build, should create image
[✓] QuarkusOcITCase - ocResource - oc:resource, should create manifests
[✓] QuarkusOcITCase - ocHelm - oc:helm, should create Helm charts
[✓] QuarkusOcTraceEnabledITCase - ocBuild - oc:build, with org.slf4j.simpleLogger.defaultLogLevel=trace, should create image and print trace logs
[✓] QuarkusOcTraceEnabledITCase - ocResource - oc:resource, should create manifests
[✓] QuarkusOcITCase - ocApply - oc:apply, should deploy pod and service
[✓] QuarkusOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] QuarkusOcTraceEnabledITCase - ocApply - oc:apply, with org.slf4j.simpleLogger.defaultLogLevel=trace, should deploy pod and service and print trace logs
[✓] QuarkusOcTraceEnabledITCase - ocLog - oc:log, with org.slf4j.simpleLogger.defaultLogLevel=trace, should retrieve log and print trace logs
[✓] QuarkusOcTraceEnabledITCase - ocUndeploy - oc:undeploy, with org.slf4j.simpleLogger.defaultLogLevel=trace, should delete all applied resources and print trace logs
[✓] All tests (5) passed successfully!!!

✔️ Test reports (Windows)
[✓] WindowsITCase - k8sBuild - k8s:build, should create image
[✓] WindowsITCase - k8sPush - k8s:push, should push image to remote registry
[✓] WindowsITCase - k8sResource - k8s:resource, should create manifests
[✓] WindowsITCase - ocResource - oc:resource, should create manifests
[✓] WindowsITCase - k8sHelm - k8s:helm, should create Helm charts
[✓] WindowsITCase - ocHelm - oc:helm, should create Helm charts
[✓] All tests (6) passed successfully!!!

✔️ Test reports (OpenShift v3.10.0-springboot)
[✓] HelmConfigITCase - ocResource - oc:resource, no specified profile, should create default resource manifests
[✓] HelmConfigITCase - ocHelm - oc:helm, should create Helm charts
[✓] HelmConfigITCase - ocHelmPush - oc:helm-push, should push the charts
[✓] CompleteOcDockerITCase - ocBuild - oc:build, with jkube.build.strategy=docker, should create image
[✓] CompleteOcDockerITCase - ocResource - oc:resource, should create manifests
[✓] CompleteOcDockerLayersDisabledITCase - ocBuild - oc:build, with jkube.build.strategy=docker, should create image
[✓] CompleteOcDockerLayersDisabledITCase - ocResource - oc:resource, should create manifests
[✓] ZeroConfigOcITCase - ocBuild - oc:build, should create image
[✓] ZeroConfigOcITCase - ocResource - oc:resource, should create manifests
[✓] ZeroConfigOcGradleITCase - ocBuild - ocBuild, should create image
[✓] ZeroConfigOcGradleITCase - ocResource - ocResource, should create manifests
[✓] WatchOcITCase - watch_whenSourceModified_shouldLiveReloadChanges - watch, SHOULD hot reload application on changes
[✓] CompleteOcDockerITCase - ocApply - oc:apply, should deploy pod and service
[✓] CompleteOcDockerLayersDisabledITCase - ocApply - oc:apply, should deploy pod and service
[✓] CompleteOcDockerITCase - ocLog - oc:log, should retrieve log
[✓] CompleteOcDockerLayersDisabledITCase - ocLog - oc:log, should retrieve log
[✓] CompleteOcDockerITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] ZeroConfigOcITCase - ocApply - oc:apply, should deploy pod and service
[✓] CompleteOcDockerLayersDisabledITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] ZeroConfigOcITCase - ocHelm - oc:helm, should create Helm charts
[✓] ZeroConfigOcGradleITCase - ocApply - ocApply, should deploy pod and service
[✓] ZeroConfigOcGradleITCase - ocHelm - ocHelm, should create Helm charts
[✓] ZeroConfigOcITCase - ocLog - oc:log, should retrieve log
[✓] ZeroConfigOcGradleITCase - ocLog - ocLog, should retrieve log
[✓] ZeroConfigOcGradleITCase - ocUndeploy - ocUndeploy, should delete all applied resources
[✓] ZeroConfigOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] All tests (1) passed successfully!!!

✔️ Test reports (OpenShift v3.10.0-webapp)
[✓] JettyOcITCase - ocBuild - oc:build, should create image
[✓] JettyOcITCase - ocResource - oc:resource, should create manifests
[✓] WildFlyOcITCase - ocBuild - oc:build, should create image
[✓] WildFlyOcITCase - ocResource - oc:resource, should create manifests
[✓] ZeroConfigOcITCase - ocBuild - oc:build, should create image
[✓] ZeroConfigOcITCase - ocResource - oc:resource, should create manifests
[✓] WildFlyOcDockerModeITCase - ocBuild - oc:build, should create image using docker
[✓] WildFlyOcDockerModeITCase - ocResource - k8s:resource, should create manifests
[✓] JettyOcITCase - ocApply - oc:apply, should deploy pod and service
[✓] JettyOcITCase - ocLog - oc:log, should retrieve log
[✓] JettyOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] WildFlyOcITCase - ocApply - oc:apply, should deploy pod and service
[✓] WildFlyOcITCase - ocLog - oc:log, should retrieve logs
[✓] ZeroConfigOcITCase - ocApply - oc:apply, should deploy pod and service
[✓] ZeroConfigOcITCase - testNodePortResponse - Service as NodePort response should return String
[✓] WildFlyOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] ZeroConfigOcITCase - ocLog - oc:log, should retrieve log
[✓] ZeroConfigOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] WildFlyOcDockerModeITCase - ocApply - oc:apply, should deploy pod and service
[✓] WildFlyOcDockerModeITCase - ocLog - oc:log, should retrieve logs
[✓] WildFlyOcDockerModeITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] All tests (5) passed successfully!!!

✔️ Test reports (OpenShift v3.10.0-other)
[✓] ThorntailOcITCase - ocBuild - oc:build, should create image
[✓] ThorntailOcITCase - ocResource - oc:resource, should create manifests
[✓] OpenLibertyOcITCase - ocBuild - oc:build, should create image
[✓] OpenLibertyOcITCase - ocResource - oc:resource, should create manifests
[✓] VertxOcITCase - ocBuild - oc:build, should create image
[✓] VertxOcITCase - ocResource - oc:resource, should create manifests
[✓] KarafOcITCase - ocBuild - oc:build, should create image
[✓] KarafOcITCase - ocResource - oc:resource, should create resource manifests
[✓] DslOcGradleITCase - ocBuild - ocBuild, should create image
[✓] DslOcGradleITCase - ocResource - ocResource, should create manifests
[✓] WildflyJarOcITCase - ocBuild - oc:build, should create image
[✓] WildflyJarOcITCase - ocResource - oc:resource, should create manifests
[✓] ThorntailOcITCase - ocApply - oc:apply, should deploy pod and service
[✓] ThorntailOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] OpenLibertyOcITCase - ocApply - oc:apply, should deploy pod and service
[✓] OpenLibertyOcITCase - ocLog - oc:log, should retrieve log
[✓] VertxOcITCase - ocApply - oc:apply, should deploy pod and service
[✓] OpenLibertyOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] VertxOcITCase - k8sLog - oc:log, should retrieve log
[✓] VertxOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] KarafOcITCase - ocApply - oc:apply, should create pod, service and route
[✓] DslOcGradleITCase - ocApply - ocApply, should deploy pod and service
[✓] DslOcGradleITCase - ocHelm - ocHelm, should create Helm charts
[✓] DslOcGradleITCase - ocLog - ocLog, should retrieve log
[✓] DslOcGradleITCase - ocUndeploy - ocUndeploy, should delete all applied resources
[✓] KarafOcITCase - ocLog - oc:log, should retrieve log
[✓] KarafOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] WildflyJarOcITCase - ocApply - oc:apply, should deploy pod and service
[✓] WildflyJarOcITCase - ocUndeploy - oc:undeploy, should delete all applied resources
[✓] All tests (4) passed successfully!!!

Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 70.62%. Comparing base (1ac4f7c) to head (34279d7).
Report is 368 commits behind head on master.

Files Patch % Lines
...nfig/service/kubernetes/BuildPackBuildService.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #2940       +/-   ##
=============================================
+ Coverage     59.36%   70.62%   +11.26%     
- Complexity     4586     5034      +448     
=============================================
  Files           500      488       -12     
  Lines         21211    19514     -1697     
  Branches       2830     2513      -317     
=============================================
+ Hits          12591    13781     +1190     
+ Misses         7370     4504     -2866     
+ Partials       1250     1229       -21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -216,7 +217,7 @@ void whenImageConfigurationContainsPackBuildArguments_thenArgumentsPassedToBuild
buildPackBuildService.buildSingleImage(imageConfiguration);

// Then
verify(kitLogger).info("[[s]]%s", "build foo/bar:latest --builder paketobuildpacks/builder:base --creation-time now --pull-policy if-not-present --volume /tmp/volume:/platform/volume:ro --tag foo/bar:t1 --tag foo/bar:t2 --tag foo/bar:t3 --env BP_SPRING_CLOUD_BINDINGS_DISABLED=true");
verify(kitLogger).info("[[s]]%s", "build foo/bar:latest --builder paketobuildpacks/builder:tiny --creation-time now --pull-policy if-not-present --volume /tmp/volume:/platform/volume:ro --tag foo/bar:t1 --tag foo/bar:t2 --tag foo/bar:t3 --env BP_SPRING_CLOUD_BINDINGS_DISABLED=true");
Copy link
Member

Choose a reason for hiding this comment

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

Ref: this is because the arguments contained also the default values which now are configurable, hence the change in the builder image as opposed to the previous DEFAULT_BUILDER_IMAGE = "paketobuildpacks/builder:base"


| *buildpacksBuilderImage*
| Configure https://buildpacks.io/docs/for-platform-operators/concepts/builder/[BuildPack builder] OCI image for BuildPack Build. This field is applicable only in `buildpacks` build strategy.
Defaults to `null`
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure this defaults to null?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that's code-wise. However, from a user's perspective, the default value is not null, but whatever default image we're using.

Copy link
Member Author

Choose a reason for hiding this comment

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

Shall I add paketobuildpacks/builder:base here instead?

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 that would make more sense than null

@codecov-commenter
Copy link

codecov-commenter commented Apr 24, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 70.74%. Comparing base (1ac4f7c) to head (01de374).
Report is 380 commits behind head on master.

Files Patch % Lines
...nfig/service/kubernetes/BuildPackBuildService.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #2940       +/-   ##
=============================================
+ Coverage     59.36%   70.74%   +11.38%     
- Complexity     4586     5057      +471     
=============================================
  Files           500      489       -11     
  Lines         21211    19548     -1663     
  Branches       2830     2518      -312     
=============================================
+ Hits          12591    13830     +1239     
+ Misses         7370     4490     -2880     
+ Partials       1250     1228       -22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…builder image

Add a field in ImageConfiguration's Build named `buildpacksBuilderImage`
that can be used by the user for configuring buildpack builder image.
This field would also be exposed via `jkube.generator.buildpacksBuilderImage` property and
generators `buildpacksBuilderImage` config

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@@ -78,6 +78,7 @@ enum Config implements Configs.Config {

// Base image mode (only relevant for OpenShift)
FROM_MODE("fromMode", null),
BUILDPACKS_BUILDER_IMAGE("buildpacksBuilderImage", null),
Copy link
Member

Choose a reason for hiding this comment

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

OK, now this starts to make more sense. Why isn't the default builder image resolved from the configuration?

Copy link
Member Author

Choose a reason for hiding this comment

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

Umm, at the moment builder image configured from ImageConfiguration has more precedence over builder image from local ~/.pack/config. If we set the default builder image here we might not be able to distinguish in BuildPackBuildService whether it has been set explicitly by the user or it's opinionated default.

Copy link
Member

Choose a reason for hiding this comment

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

OK, I recall there was a similar situation for other configuration flags.
I can't recall how those got fixed.

Copy link
Member

Choose a reason for hiding this comment

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

Let's move on with this, and we can check at another moment

Copy link
Member

@manusa manusa left a comment

Choose a reason for hiding this comment

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

LGTM, thx!

Copy link

sonarcloud bot commented Apr 24, 2024

@manusa manusa merged commit d9d630b into eclipse-jkube:master Apr 24, 2024
9 checks passed
@rohanKanojia rohanKanojia deleted the pr/issue2470 branch April 24, 2024 11:03
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.

[US] Configure buildpack builder image
3 participants