Skip to content

Commit

Permalink
test: bind mount gomodcache to cache go dependencies
Browse files Browse the repository at this point in the history
try to speed up ci jobs integration tests
  • Loading branch information
kruskall committed Dec 1, 2024
1 parent ec2f4a8 commit 63a7a38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dev-tools/mage/integtest_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,15 @@ func integTestDockerComposeEnvVars() (map[string]string, error) {
return nil, err
}

goModCache := os.Getenv("GOMODCACHE")
if goModCache == "" {
goModCache = os.Getenv("GOPATH") + "/pkg/mod"
}

return map[string]string{
"ES_BEATS": esBeatsDir,
"STACK_ENVIRONMENT": StackEnvironment,
"GOMODCACHE": goModCache,
// Deprecated use STACK_ENVIRONMENT instead (it's more descriptive).
"TESTING_ENVIRONMENT": StackEnvironment,
}, nil
Expand Down
1 change: 1 addition & 0 deletions metricbeat/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
working_dir: /go/src/github.com/elastic/beats/metricbeat
volumes:
- ${PWD}/..:/go/src/github.com/elastic/beats/
- ${GOMODCACHE}:/go/pkg/mod/:ro
- /var/run/docker.sock:/var/run/docker.sock
network_mode: host
command: make
Expand Down

0 comments on commit 63a7a38

Please sign in to comment.