mirror of
https://gitlab.sectorq.eu/jaydee/registry-utils.git
synced 2025-12-14 10:44:52 +01:00
lala
This commit is contained in:
@@ -58,11 +58,31 @@ def generate_config(data):
|
|||||||
print(config)
|
print(config)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
def push_to_registry(data):
|
||||||
|
local_registry = "localhost:5000/library/"
|
||||||
|
for line in data:
|
||||||
|
if "localhost:5000" in line:
|
||||||
|
continue
|
||||||
|
d = line.split()
|
||||||
|
print(f"{d[0]} : {d[1]}")
|
||||||
|
image = d[0].split("/")
|
||||||
|
if "<none>" == d[1]:
|
||||||
|
#yaml_config["sync"].append({"source":f"{d[0]}","target": f"{local_registry}{d[0]}","type":"image","interval":interval,"backup": "\"backup-{{.Ref.Tag}}\""})
|
||||||
|
cmnd = f"docker tag {d[0]} {local_registry}{d[0]}"
|
||||||
|
input(cmnd)
|
||||||
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
cmnd = f"docker tag {d[0]}:{d[1]} {local_registry}{d[0]}:{d[1]}"
|
||||||
|
input(cmnd)
|
||||||
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
if _ACTION == "generate_config":
|
if _ACTION == "generate_config":
|
||||||
generate_config(get_docker_images())
|
generate_config(get_docker_images())
|
||||||
|
|
||||||
elif _ACTION == "write_to_registry":
|
elif _ACTION == "push_to_registry":
|
||||||
get_docker_images()
|
push_to_registry(get_docker_images())
|
||||||
|
|||||||
Reference in New Issue
Block a user