Skip to content

Commit

Permalink
Merge pull request #9 from MisterMX/feat/build-runtime-image
Browse files Browse the repository at this point in the history
feat(build): Add support for runtime images from tarballs
  • Loading branch information
MisterMX authored Mar 28, 2024
2 parents 3430b50 + 8179130 commit 770edd7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
7 changes: 4 additions & 3 deletions cmd/crossplanereleaser/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ func (c *buildCmd) Run(fsys afero.Fs) error {
func (c *buildCmd) buildPackages(ctx context.Context, fsys afero.Fs, cfg *v1.Config) error {
for _, b := range cfg.Builds {
buildCfg := &build.PackageBuildConfig{
PackageDir: b.Dir,
ExamplesDir: b.Examples,
OutputPath: getPackageOutputPath(cfg, &b),
PackageDir: b.Dir,
ExamplesDir: b.Examples,
OutputPath: getPackageOutputPath(cfg, &b),
RuntimeImageTar: b.RuntimeImageTar,
}
// We need to call mkdir here because crank doesn't do it for us
if err := fsys.MkdirAll(filepath.Dir(buildCfg.OutputPath), 0755); err != nil {
Expand Down
9 changes: 5 additions & 4 deletions config/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ type Config struct {
}

type BuildConfig struct {
ID string `json:"id"`
Dir string `json:"dir"`
Examples string `json:"examples"`
NameTemplate string `json:"name_template"`
ID string `json:"id"`
Dir string `json:"dir"`
Examples string `json:"examples"`
NameTemplate string `json:"name_template"`
RuntimeImageTar string `json:"runtime_image_tar"`
}

type PushConfig struct {
Expand Down
7 changes: 4 additions & 3 deletions internal/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
)

type PackageBuildConfig struct {
PackageDir string
ExamplesDir string
OutputPath string
PackageDir string
ExamplesDir string
OutputPath string
RuntimeImageTar string
}

type BuilderBackend interface {
Expand Down
4 changes: 3 additions & 1 deletion internal/build/build_crank.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func (c *CrankCLIBackend) BuildPackage(ctx context.Context, cfg *PackageBuildCon
if cfg.ExamplesDir != "" {
args = append(args, fmt.Sprintf("--examples-root=%s", cfg.ExamplesDir))
}
// TODO: Support setting --controller-tar option
if cfg.RuntimeImageTar != "" {
args = append(args, fmt.Sprintf("--embed-runtime-image-tarball=%s", cfg.RuntimeImageTar))
}
return c.exec(ctx, args...)
}

0 comments on commit 770edd7

Please sign in to comment.