kopia lustrzana https://github.com/jupyterhub/repo2docker
commit
0d89f44d37
|
@ -89,36 +89,6 @@ class Repo2Docker(Application):
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
cleanup_checkout = Bool(
|
|
||||||
True,
|
|
||||||
config=True,
|
|
||||||
help="""
|
|
||||||
Set to True to clean up the checked out directory after building is done.
|
|
||||||
|
|
||||||
Will only clean up after a successful build - failed builds will still leave their
|
|
||||||
checkouts intact.
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
push = Bool(
|
|
||||||
False,
|
|
||||||
config=True,
|
|
||||||
help="""
|
|
||||||
If the image should be pushed after it is built.
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
run = Bool(
|
|
||||||
True,
|
|
||||||
config=True,
|
|
||||||
help="""
|
|
||||||
Run the image after it is built, if the build succeeds.
|
|
||||||
|
|
||||||
DANGEROUS WHEN DONE IN A CLOUD ENVIRONMENT! ONLY USE LOCALLY!
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
def fetch(self, url, ref, checkout_path):
|
def fetch(self, url, ref, checkout_path):
|
||||||
try:
|
try:
|
||||||
for line in execute_cmd(['git', 'clone', url, checkout_path],
|
for line in execute_cmd(['git', 'clone', url, checkout_path],
|
||||||
|
@ -181,6 +151,13 @@ class Repo2Docker(Application):
|
||||||
help='Do not run container after it has been built'
|
help='Do not run container after it has been built'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
argparser.add_argument(
|
||||||
|
'--no-clean',
|
||||||
|
dest='clean',
|
||||||
|
action='store_false',
|
||||||
|
help="Don't clean up remote checkouts after we are done"
|
||||||
|
)
|
||||||
|
|
||||||
argparser.add_argument(
|
argparser.add_argument(
|
||||||
'cmd',
|
'cmd',
|
||||||
nargs='*',
|
nargs='*',
|
||||||
|
@ -199,10 +176,12 @@ class Repo2Docker(Application):
|
||||||
self.repo_type = 'local'
|
self.repo_type = 'local'
|
||||||
self.repo = args.repo
|
self.repo = args.repo
|
||||||
self.ref = None
|
self.ref = None
|
||||||
|
self.cleanup_checkout = False
|
||||||
else:
|
else:
|
||||||
self.repo_type = 'remote'
|
self.repo_type = 'remote'
|
||||||
self.repo = args.repo
|
self.repo = args.repo
|
||||||
self.ref = args.ref
|
self.ref = args.ref
|
||||||
|
self.cleanup_checkout = args.clean
|
||||||
|
|
||||||
if args.json_logs:
|
if args.json_logs:
|
||||||
# Need to reset existing handlers, or we repeat messages
|
# Need to reset existing handlers, or we repeat messages
|
||||||
|
@ -329,7 +308,7 @@ class Repo2Docker(Application):
|
||||||
else:
|
else:
|
||||||
self.log.info(json.dumps(l), extra=dict(phase='building'))
|
self.log.info(json.dumps(l), extra=dict(phase='building'))
|
||||||
|
|
||||||
if self.repo_type != 'local' and self.cleanup_checkout:
|
if self.cleanup_checkout:
|
||||||
shutil.rmtree(checkout_path)
|
shutil.rmtree(checkout_path)
|
||||||
|
|
||||||
if self.push:
|
if self.push:
|
||||||
|
|
Ładowanie…
Reference in New Issue