Skip to content

Commit

Permalink
Signed-off-by: sarthak <[email protected]>
Browse files Browse the repository at this point in the history
remove stack and implement suggested changes
  • Loading branch information
sarthaksarthak9 committed Jan 23, 2024
1 parent 648fe74 commit ecfea6f
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions pkg/client/new_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@ import (
"github.com/buildpacks/pack/pkg/dist"
)

var (
bashBinGenerate = `#!/usr/bin/env bash
set -eo pipefail
# 1. GET ARGS
output_dir=$CNB_OUTPUT_DIR
# 2. GENERATE build.Dockerfile
cat >> "${output_dir}/build.Dockerfile" <<EOL
ARG base_image
FROM \${base_image}
RUN echo "Hello from build extension"
EOL
# 3. GENERATE run.Dockerfile
cat >> "${output_dir}/run.Dockerfile" <<EOL
ARG base_image
FROM \${base_image}
RUN echo "Hello from run extension"
EOL
`
)

type NewExtensionOptions struct {
// api compat version of the output extension artifact.
API string
Expand All @@ -25,9 +51,6 @@ type NewExtensionOptions struct {

// version of the output extension artifact.
Version string

// Deprecated: The stacks this extension will work with
Stacks []dist.Stack
}

func (c *Client) NewExtension(ctx context.Context, opts NewExtensionOptions) error {
Expand All @@ -39,7 +62,7 @@ func (c *Client) NewExtension(ctx context.Context, opts NewExtensionOptions) err
}

func createBashExtension(path string, c *Client) error {
if err := createBinScript(path, "build", bashBinBuild, c); err != nil {
if err := createBinScript(path, "generate", bashBinGenerate, c); err != nil {
return err
}

Expand Down

0 comments on commit ecfea6f

Please sign in to comment.