updated kaniko wrapper; fixed ssl

This commit is contained in:
STAM 2024-06-24 15:39:26 +03:00
parent 1e31bdbb06
commit 3a1e4fa96a
Signed by: stam
GPG Key ID: E149C3760CFA3C7E
1677 changed files with 39768 additions and 37120 deletions

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -10,7 +10,7 @@ import logging
import sys import sys
# Script version # Script version
SCRIPT_VERSION = "1.0.0.1" SCRIPT_VERSION = "1.0.1.0"
# ASCII art for EpicMorg # ASCII art for EpicMorg
ASCII_ART = r""" ASCII_ART = r"""
@ -107,6 +107,7 @@ def build_with_kaniko(service_name, build_context, dockerfile, image_name, build
for line in process.stderr: for line in process.stderr:
logging.error(line.strip()) logging.error(line.strip())
logging.error(f"Error building {service_name}") logging.error(f"Error building {service_name}")
raise Exception(f"Failed to build {service_name}")
def show_help(): def show_help():
print(ASCII_ART) print(ASCII_ART)
@ -166,29 +167,30 @@ def main():
logging.error(f"Error: Image name {image_name} is used {count} times.") logging.error(f"Error: Image name {image_name} is used {count} times.")
return return
with ThreadPoolExecutor() as executor: try:
futures = [] with ThreadPoolExecutor() as executor:
for service_name, service_data in services.items(): futures = []
build_data = service_data.get('build', {}) for service_name, service_data in services.items():
build_context = build_data.get('context', '.') build_data = service_data.get('build', {})
dockerfile = build_data.get('dockerfile', 'Dockerfile') build_context = build_data.get('context', '.')
image_name = service_data.get('image') dockerfile = build_data.get('dockerfile', 'Dockerfile')
build_args = build_data.get('args', {}) image_name = service_data.get('image')
build_args = build_data.get('args', {})
# Substitute environment variables with their values if they exist # Substitute environment variables with their values if they exist
build_args = {key: os.getenv(key, value) for key, value in build_args.items()} build_args = {key: os.getenv(key, value) for key, value in build_args.items()}
if not image_name: if not image_name:
logging.warning(f"No image specified for service {service_name}") logging.warning(f"No image specified for service {service_name}")
continue continue
futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry)) futures.append(executor.submit(build_with_kaniko, service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry))
for future in as_completed(futures): for future in as_completed(futures):
try:
future.result() future.result()
except Exception as exc: except Exception as exc:
logging.error(f"Generated an exception: {exc}") logging.error(f"Build failed: {exc}")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

Some files were not shown because too many files have changed in this diff Show More