Skip to content

Commit

Permalink
WIP - working version using command: ./out/pack build oci:oci-example…
Browse files Browse the repository at this point in the history
… --builder cnbs/jbustamantevmware-builder:bionic --verbose --path /Users/jbustamante/workspace/buildpack.io/samples/apps/java-maven --verbose --trust-builder

Signed-off-by: Juan Bustamante <[email protected]>
  • Loading branch information
jjbustamante committed Jan 11, 2023
1 parent a409fc5 commit 52af388
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
13 changes: 11 additions & 2 deletions internal/build/lifecycle_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,14 @@ func (l *LifecycleExecution) Analyze(ctx context.Context, buildCache, launchCach
flagsOp := WithFlags(flags...)

var analyze RunnerCleaner
if l.opts.Publish {

layoutOpts := NullOp()
if l.opts.LayoutPath != "" {
args = append([]string{"-layout"}, args...)
layoutOpts = WithBinds(fmt.Sprintf("%s:%s", l.opts.LayoutPath, l.mountPaths.LayoutDir()))
}

if l.opts.Publish || l.opts.LayoutPath != "" {
authConfig, err := auth.BuildEnvVar(authn.DefaultKeychain, l.opts.Image.String(), l.opts.RunImage, l.opts.CacheImage, l.opts.PreviousImage)
if err != nil {
return err
Expand All @@ -505,14 +512,15 @@ func (l *LifecycleExecution) Analyze(ctx context.Context, buildCache, launchCach
l,
WithLogPrefix("analyzer"),
WithImage(l.opts.LifecycleImage),
WithEnv(fmt.Sprintf("%s=%d", builder.EnvUID, l.opts.Builder.UID()), fmt.Sprintf("%s=%d", builder.EnvGID, l.opts.Builder.GID())),
WithEnv(fmt.Sprintf("%s=%d", builder.EnvUID, l.opts.Builder.UID()), fmt.Sprintf("%s=%d", builder.EnvGID, l.opts.Builder.GID()), "CNB_EXPERIMENTAL_MODE=warn"),
WithRegistryAccess(authConfig),
WithRoot(),
WithArgs(l.withLogLevel(args...)...),
WithNetwork(l.opts.Network),
flagsOp,
cacheBindOp,
stackOp,
layoutOpts,
)

analyze = phaseFactory.New(configProvider)
Expand Down Expand Up @@ -677,6 +685,7 @@ func (l *LifecycleExecution) Export(ctx context.Context, buildCache, launchCache
opts,
WithFlags("-layout"),
WithBinds(fmt.Sprintf("%s:%s", l.opts.LayoutPath, l.mountPaths.LayoutDir())),
WithEnv("CNB_EXPERIMENTAL_MODE=warn"),
)
} else {
opts = append(
Expand Down
2 changes: 2 additions & 0 deletions internal/build/lifecycle_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ var (
api.MustParse("0.8"),
api.MustParse("0.9"),
api.MustParse("0.10"),
api.MustParse("0.11"),
api.MustParse("0.12"),
}
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/client/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {
Termui: termui.NewTermui(imageName, ephemeralBuilder, runImageName),
SBOMDestinationDir: opts.SBOMDestinationDir,
CreationTime: opts.CreationTime,
LayoutPath: layoutRootPath,
}

lifecycleVersion := ephemeralBuilder.LifecycleDescriptor().Info.Version
Expand All @@ -418,7 +419,7 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {
lifecycleSupportsCreator := !lifecycleVersion.LessThan(semver.MustParse(minLifecycleVersionSupportingCreator))

if lifecycleSupportsCreator && opts.TrustBuilder(opts.Builder) {
lifecycleOpts.UseCreator = true
lifecycleOpts.UseCreator = false
// no need to fetch a lifecycle image, it won't be used
if err := c.lifecycleExecutor.Execute(ctx, lifecycleOpts); err != nil {
return errors.Wrap(err, "executing lifecycle")
Expand Down

0 comments on commit 52af388

Please sign in to comment.