1616ddiff_url_base = ddiff_url .replace ("https://" , "" ).replace ("http://" , "" ).replace ("//" , "/" )
1717ddiff_container_name = os .getenv ("DDIFF_CONTAINER_NAME" , "ddiff-registry" )
1818ddiff_register_volume = os .getenv ("DDIFF_REGISTRY_VOLUME" )
19+ ddiff_disable_repository = os .getenv ("DDIFF_DISABLE_RESPOSITORY" , False )
1920
2021def print_debug (* args ):
2122 print ("[ddiff]" , * args )
@@ -37,7 +38,8 @@ def run_command(cmd, capture_output=False):
3738# return ddiff_registry_home, ddiff_registry_data_location, docker_registry_data_location
3839
3940def _prepare_tag (tag ):
40- tag = tag .replace ("/" , "-" )
41+ if ddiff_disable_repository :
42+ tag = tag .replace ("/" , "-" )
4143 if ":" not in tag :
4244 tag += ":latest"
4345 return tag
@@ -202,7 +204,7 @@ def diff_image(base_tag, target_tag):
202204 f .write ("|" .join (diff_blobs ))
203205
204206 print_debug ("Archiving..." )
205- archive_name = f"{ target_tag .replace (':' , '-' )} .tar.gz"
207+ archive_name = f"{ target_tag .replace ('/' , '--' ). replace ( ' :' , '-' )} .tar.gz"
206208 with tarfile .open (archive_name , "w:gz" ) as tar :
207209 tar .add (output_dir , arcname = ".ddiff-image" )
208210
@@ -217,7 +219,7 @@ def load_image(base_tag, image_tarball):
217219 tar .extractall ()
218220
219221 # Parse base tag from the manifest onlyif not given
220- if base_tag is None
222+ if base_tag is None :
221223 with open (os .path .join (input_dir , "BASE" )) as f :
222224 base_tag = f .read ().strip ()
223225 base_repo = base_tag .split (":" )[0 ]
@@ -291,7 +293,7 @@ def list_blobs(tag):
291293 if len (sys .argv ) < 2 or not sys .argv [1 ] in ["server" , "push" , "pull" , "diff" , "load" , "build" , "list" ]:
292294 print ("Usage: ddiff [command] [args...]" )
293295 print ("Commands:" )
294- print (" server - Run the registry server" )
296+ print (" server - Run the registry server (set DDIFF_REGISTRY_VOLUME) " )
295297 print (" push <tag 1> ... <tag n> - Push one or more images" )
296298 print (" pull <tag 1> ... <tag n> - Pull one or more images" )
297299 print (" diff <base> <target> - Diff the target image from the base image" )
@@ -305,7 +307,7 @@ def list_blobs(tag):
305307
306308 if command == "server" :
307309 if args :
308- print ("Usage: python3 ddiff.py server" )
310+ print ("Usage: DDIFF_REGISTRY_VOLUME=<path to volume> python3 ddiff.py server" )
309311 sys .exit (1 )
310312 run_registry ()
311313 elif command == "push" :
0 commit comments