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(build): Add support for runtime images from tarballs #9

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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...)
}
Loading