Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Address CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Larroy committed Aug 23, 2018
1 parent 9fadeb4 commit c513740
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions ci/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,6 @@ def under_ci() -> bool:
return 'JOB_NAME' in os.environ


def git_cleanup() -> None:
"""Clean repo and subrepos, update subrepos"""
logging.info("cleaning up repository")
with remember_cwd():
os.chdir(get_mxnet_root())
check_call(['git', 'clean', '-ffdx'])
check_call(['git', 'submodule', 'foreach', '--recursive', 'git', 'clean', '-ffdx'])
check_call(['git', 'submodule', 'update', '--recursive', '--init'])


def get_dockerfiles_path():
return "docker"

Expand Down Expand Up @@ -148,6 +138,10 @@ def build_docker(platform: str, docker_binary: str, registry: str, num_retries:
# cache-from is needed so we use the cached images tagged from the remote via
# docker pull see: docker_cache.load_docker_cache
#
# This also prevents using local layers for caching: https://github.com/moby/moby/issues/33002
# So to use local caching, we should omit the cache-from by using --no-cache argument to this
# script.
#
# This doesn't work with multi head docker files.
#
cmd = [docker_binary, "build",
Expand Down Expand Up @@ -253,7 +247,7 @@ def container_run(platform: str,
logging.error("You can get into the container by adding the -i option")
raise subprocess.CalledProcessError(ret, cmd)

return ret
return ret


def list_platforms() -> str:
Expand Down Expand Up @@ -365,7 +359,8 @@ def main() -> int:
type=int)

parser.add_argument("--no-cache", action="store_true",
help="Enable docker registry cache")
help="Disables use of --cache-from option on docker build, allowing docker"
"to use local layers for caching. If absent, we use the cache from dockerhub.")

parser.add_argument("command",
help="command to run in the container",
Expand Down Expand Up @@ -433,7 +428,6 @@ def use_cache():
use_cache=use_cache())
if args.build_only:
continue
git_cleanup()
shutil.rmtree(buildir(), ignore_errors=True)
build_platform = "build_{}".format(platform)
plat_buildir = os.path.abspath(os.path.join(get_mxnet_root(), '..',
Expand Down Expand Up @@ -472,8 +466,7 @@ def use_cache():
./build.py -a
Builds for all platforms and leaves artifacts in build_<platform>. **WARNING** it performs git
cleanup of the repo.
Builds for all platforms and leaves artifacts in build_<platform>.
""")

Expand Down

0 comments on commit c513740

Please sign in to comment.