Skip to content

Commit

Permalink
export all images
Browse files Browse the repository at this point in the history
  • Loading branch information
Vad1mo committed Nov 22, 2024
1 parent 2d56ca2 commit e11e143
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .dagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ type BuildMetadata struct {
}

func New(
// Local or remote directory with source code, defaults to "./"
// +optional
// +defaultPath="./"
// Local or remote directory with source code, defaults to "./"
// +optional
// +defaultPath="./"
source *dagger.Directory,
) *Harbor {
return &Harbor{Source: source}
Expand All @@ -41,6 +41,19 @@ type Harbor struct {
Source *dagger.Directory
}

func (m *Harbor) ExportAllImages(ctx context.Context) (string, error) {
metdata := m.buildAllImages(ctx)
for _, meta := range metdata {
export, err := meta.Container.Export(ctx, fmt.Sprintf("bin/container/%s/%s.tgz", meta.Platform, meta.Package))
export, err := meta.Container.AsTarball(ctx, fmt.Sprintf("bin/container/%s/%s.tgz", meta.Platform, meta.Package))
println(export)
if err != nil {
return "", err
}
}
return "bin/container", nil
}

func (m *Harbor) BuildAllImages(ctx context.Context) []*dagger.Container {
metdata := m.buildAllImages(ctx)
images := make([]*dagger.Container, len(metdata))
Expand Down

0 comments on commit e11e143

Please sign in to comment.