forked from toolshed/abra-bash
		
	Hashed out a very broken tags gathering logic
This commit is contained in:
		@ -91,16 +91,32 @@ def get_app_features(app_path):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_app_versions(app_path):
 | 
					def get_app_versions(app_path):
 | 
				
			||||||
    versions = {}
 | 
					    versions = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    chdir(app_path)
 | 
					    chdir(app_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tags = check_output(f"git tag --list", shell=True).strip()
 | 
					    tags = check_output(f"git tag --list", shell=True).strip()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for tag in tags:
 | 
					    for tag in tags:
 | 
				
			||||||
        # TODO
 | 
					        run(f"git checkout", shell=True)
 | 
				
			||||||
        # checkout that tag in the local git branch
 | 
					
 | 
				
			||||||
        # parse all service images via yq or other magic
 | 
					        services_command = "yq e .services | keys | .[] compose*.yml"
 | 
				
			||||||
        # lookup the digest with skopeo
 | 
					        services = check_output(services_command, shell=True).decode("utf-8").split()
 | 
				
			||||||
        pass
 | 
					
 | 
				
			||||||
 | 
					        for service in services:
 | 
				
			||||||
 | 
					            images_command = f"yq e '.services.{service}.image' compose*.yml"
 | 
				
			||||||
 | 
					            images = check_output(images_command, shell=True).decode("utf-8").split()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            for image in images:
 | 
				
			||||||
 | 
					                if image in ("null", "---"):
 | 
				
			||||||
 | 
					                    continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                digest_command = f"skopeo inspect {image} | yq '.Digest'"
 | 
				
			||||||
 | 
					                output = check_output(digest_command, shell=True).decode("utf-8")
 | 
				
			||||||
 | 
					                digest = output.strip().split(":")[-1][:8]
 | 
				
			||||||
 | 
					                versions.append(
 | 
				
			||||||
 | 
					                    {service: {"image": image, "tag": tag, "digest": digest}}
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return versions
 | 
					    return versions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user