From e6d0079051c80b02cf9a75ff81b6255a5fc7300a Mon Sep 17 00:00:00 2001 From: Pedro Nasser Date: Mon, 12 Sep 2016 14:44:11 -0300 Subject: [PATCH] add IGNORE_MEMORY --- api/runner/runner.go | 21 +++++++++++++-------- test.sh | 4 +++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/api/runner/runner.go b/api/runner/runner.go index b79257d89..0d24f9a24 100644 --- a/api/runner/runner.go +++ b/api/runner/runner.go @@ -196,15 +196,20 @@ func dynamicSizing(reqMem uint64) int { reqMem = 128 } - availableMemory, err := checkCgroup() - if err != nil { - logrus.WithError(err).Error("Error checking for cgroup memory limits, falling back to host memory available..") - } - if availableMemory > tooBig || availableMemory == 0 { - // Then -m flag probably wasn't set, so use max available on system - availableMemory, err = checkProc() + var availableMemory uint64 + if os.Getenv("IGNORE_MEMORY") == "1" { + availableMemory = tooBig + } else { + availableMemory, err := checkCgroup() + if err != nil { + logrus.WithError(err).Error("Error checking for cgroup memory limits, falling back to host memory available..") + } if availableMemory > tooBig || availableMemory == 0 { - logrus.WithError(err).Fatal("Your Linux version is too old (<3.14) then we can't get the proper information to . You must specify the maximum available memory by passing the -m command with docker run when starting the runner via docker, eg: `docker run -m 2G ...`") + // Then -m flag probably wasn't set, so use max available on system + availableMemory, err = checkProc() + if availableMemory > tooBig || availableMemory == 0 { + logrus.WithError(err).Fatal("Your Linux version is too old (<3.14) then we can't get the proper information to . You must specify the maximum available memory by passing the -m command with docker run when starting the runner via docker, eg: `docker run -m 2G ...`") + } } } diff --git a/test.sh b/test.sh index 6a3cab8cc..a65989aeb 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,7 @@ export GO15VENDOREXPERIMENT=1 -docker run --rm -it -m 2G -v /var/run/docker.sock:/var/run/docker.sock \ +export IGNORE_MEMORY=1 + +docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock \ -e TEST_DOCKER_USERNAME \ -e TEST_DOCKER_PASSWORD \ -e CI="$CI" \