Skip to content

Commit

Permalink
hof/test: make arch configurable in dagger code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Worm committed Dec 15, 2024
1 parent 11fd363 commit f25116e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/dagger/hof.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ func (R *Runtime) GolangImage(platform string) (*dagger.Container) {
From(goVer)

// setup mod cache
modCache := R.Client.CacheVolume("gomod-" + platform)
modCache := R.Client.CacheVolume(fmt.Sprintf("gomod-%s-%s", goVer, platform))
c = c.WithMountedCache("/go/pkg/mod", modCache)

// setup build cache
buildCache := R.Client.CacheVolume("go-build-" + platform)
buildCache := R.Client.CacheVolume(fmt.Sprintf("go-build-%s-%s", goVer, platform))
c = c.WithMountedCache("/root/.cache/go-build", buildCache)

// setup workdir
Expand Down
6 changes: 4 additions & 2 deletions test/dagger/main/hof.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ func check(err error) {
}

var RUNTIME string
var ARCH string
var TESTS string

func init() {
pflag.StringVarP(&RUNTIME, "runtime", "r", "docker", "container runtime to use [docker, nerdctl, podman, none]")
pflag.StringVarP(&ARCH, "arch", "a", "amd64", "arch identifier, like golang uses")
pflag.StringVarP(&TESTS, "tests", "t", "", "tests to run, comma separated")
}

Expand Down Expand Up @@ -54,10 +56,10 @@ func main() {
//
// Building
//
base := R.GolangImage("linux/amd64")
base := R.GolangImage("linux/"+ARCH)
deps := R.FetchDeps(base, source)
builder := R.BuildHof(deps, source)
runner := R.RuntimeContainer(builder, "linux/amd64")
runner := R.RuntimeContainer(builder, "linux/"+ARCH)

//
// TESTS
Expand Down

0 comments on commit f25116e

Please sign in to comment.