Skip to content

Commit f25116e

Browse files
author
Tony Worm
committed
hof/test: make arch configurable in dagger code
1 parent 11fd363 commit f25116e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/dagger/hof.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ func (R *Runtime) GolangImage(platform string) (*dagger.Container) {
2121
From(goVer)
2222

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

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

3131
// setup workdir

test/dagger/main/hof.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ func check(err error) {
2121
}
2222

2323
var RUNTIME string
24+
var ARCH string
2425
var TESTS string
2526

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

@@ -54,10 +56,10 @@ func main() {
5456
//
5557
// Building
5658
//
57-
base := R.GolangImage("linux/amd64")
59+
base := R.GolangImage("linux/"+ARCH)
5860
deps := R.FetchDeps(base, source)
5961
builder := R.BuildHof(deps, source)
60-
runner := R.RuntimeContainer(builder, "linux/amd64")
62+
runner := R.RuntimeContainer(builder, "linux/"+ARCH)
6163

6264
//
6365
// TESTS

0 commit comments

Comments
 (0)