Skip to content

Commit

Permalink
run steps in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
chrira committed Nov 12, 2024
1 parent 05a1fb0 commit 612828f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions ci/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"dagger/ci/internal/dagger"
"fmt"
"sync"
)

type Ci struct{}
Expand Down Expand Up @@ -158,3 +159,36 @@ func (m *Ci) Ci(ctx context.Context, dir *dagger.Directory) *Results {
Image: image,
}
}

// Executes all the steps and returns a Results object
func (m *Ci) CiIntegration(ctx context.Context, dir *dagger.Directory) *Results {
var wg sync.WaitGroup
wg.Add(3)

var lintOutput, _ = func() (string, error) {
defer wg.Done()
return "empty", error(nil) //m.Lint(ctx, dir)
}()

var securityScan = func() *dagger.File {
defer wg.Done()
return m.Sast(ctx, dir)
}()

//vulnerabilityScan := m.Vulnscan(ctx, m.SbomBuild(ctx, dir))

var image = func() *dagger.Container {
defer wg.Done()
return m.Build(ctx, dir)
}()

// This Blocks the execution until its counter become 0
wg.Wait()

return &Results{
LintOutput: lintOutput,
SecurityScan: securityScan,
// VulnerabilityScan: vulnerabilityScan,
Image: image,
}
}

0 comments on commit 612828f

Please sign in to comment.