mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Implemented new filter for image logic in docker-compose.yml.j2 und env.j2 files
This commit is contained in:
20
filter_plugins/docker_image.py
Normal file
20
filter_plugins/docker_image.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# filter_plugins/docker_image.py
|
||||
|
||||
def get_docker_image(applications, application_id, image_key):
|
||||
app = applications.get(application_id, {})
|
||||
docker = app.get("docker", {})
|
||||
images = docker.get("images", {})
|
||||
versions = docker.get("versions", {})
|
||||
version = versions.get(image_key) or app.get("version")
|
||||
image = images.get(image_key)
|
||||
|
||||
if not image or not version:
|
||||
raise ValueError(f"Missing image or version for {application_id}:{image_key}")
|
||||
|
||||
return f"{image}:{version}"
|
||||
|
||||
class FilterModule(object):
|
||||
def filters(self):
|
||||
return {
|
||||
'get_docker_image': get_docker_image,
|
||||
}
|
Reference in New Issue
Block a user