Skip to content

Commit

Permalink
Add build step
Browse files Browse the repository at this point in the history
  • Loading branch information
buehlmann committed Nov 14, 2024
1 parent 215af68 commit 09d8eff
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
12 changes: 12 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
docile (1.4.1)
drb (2.2.0)
ruby2_keywords
dry-configurable (1.1.0)
Expand Down Expand Up @@ -617,6 +618,14 @@ GEM
websocket (~> 1.0)
sentry-raven (3.1.2)
faraday (>= 1.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov-rcov (0.3.7)
simplecov (>= 0.4.1)
simplecov_json_formatter (0.1.4)
simpleidn (0.2.1)
unf (~> 0.1.4)
snaky_hash (2.0.1)
Expand Down Expand Up @@ -736,6 +745,7 @@ DEPENDENCIES
m
matrix
mini_racer
minitest
minitest-reporters
mocha
nested_form_fields
Expand Down Expand Up @@ -778,6 +788,8 @@ DEPENDENCIES
selectize-rails
selenium-webdriver
sentry-raven
simplecov
simplecov-rcov
spring
swagger-blocks
terser
Expand Down
39 changes: 24 additions & 15 deletions ci/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ type Results struct {

// Returns a Container built from the Dockerfile in the provided Directory
func (m *Ci) Build(_ context.Context, dir *dagger.Directory) *dagger.Container {
return dag.Container().Build(dir)
return dag.Container().
WithDirectory("/src", dir).
WithWorkdir("/src").
Directory("/src").
DockerBuild()
}

// Returns the result of haml-lint run against the sources in the provided Directory
Expand Down Expand Up @@ -178,6 +182,11 @@ func (m *Ci) BaseTestContainer(_ context.Context, dir *dagger.Directory) *dagger
WithExec([]string{"bundle", "install", "--jobs", "4", "--retry", "3"})
}

// Publish the Container built from the Dockerfile in the provided registry
func (m *Ci) Publish(ctx context.Context, dir *dagger.Directory, destImage string) (string, error) {
return m.Build(ctx, dir).Publish(ctx, destImage)
}

// Executes all the steps and returns a Results object
func (m *Ci) Ci(
ctx context.Context,
Expand Down Expand Up @@ -226,14 +235,14 @@ func (m *Ci) CiIntegration(
}()

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

var testReports = func() *dagger.Directory {
Expand All @@ -250,11 +259,11 @@ func (m *Ci) CiIntegration(
securityScanName, _ := securityScan.Name(ctx)
//vulnerabilityScanName, _ := vulnerabilityScan.Name(ctx)
result_container := dag.Container().
WithWorkdir("/tmp/out").
WithFile(fmt.Sprintf("/tmp/out/lint/%s", lintOutputName), lintOutput).
WithFile(fmt.Sprintf("/tmp/out/scan/%s", securityScanName), securityScan).
WithDirectory("/tmp/out/unit-tests/", testReports)
//WithFile(fmt.Sprintf("/tmp/out/vuln/%s", vulnerabilityScanName), vulnerabilityScan)
WithWorkdir("/tmp/out").
WithFile(fmt.Sprintf("/tmp/out/lint/%s", lintOutputName), lintOutput).
WithFile(fmt.Sprintf("/tmp/out/scan/%s", securityScanName), securityScan).
WithDirectory("/tmp/out/unit-tests/", testReports)
//WithFile(fmt.Sprintf("/tmp/out/vuln/%s", vulnerabilityScanName), vulnerabilityScan)
return result_container.
Directory(".")
Directory(".")
}

0 comments on commit 09d8eff

Please sign in to comment.