From c65e9966d9513dfcd2e36b3e3095beff9b787730 Mon Sep 17 00:00:00 2001 From: Christoph Raaflaub Date: Tue, 12 Nov 2024 21:07:52 +0100 Subject: [PATCH] readd ci-integration function --- .github/workflows/dagger.yaml | 2 +- ci/main.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dagger.yaml b/.github/workflows/dagger.yaml index dbb8fb2f..f3829958 100644 --- a/.github/workflows/dagger.yaml +++ b/.github/workflows/dagger.yaml @@ -4,7 +4,7 @@ on: branches: - dagger-ci jobs: - lint: + pipeline: runs-on: 'ubuntu-latest' steps: - uses: actions/checkout@v4 diff --git a/ci/main.go b/ci/main.go index b1a52788..0dd44d96 100644 --- a/ci/main.go +++ b/ci/main.go @@ -18,6 +18,7 @@ import ( "context" "dagger/ci/internal/dagger" "fmt" + "sync" ) type Ci struct{} @@ -163,3 +164,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, + } +}